递归求数组元素之和
public class Main {public static void main(String[] args) {
int b=100;
int a[]=new int[10];
for(int i=0;i<10;i++)
{
a[i]=i+1;System.out.print(a[i]+" ");
}
b=ff(a,100);
try{
System.out.print(b);
}catch (Exception e){
System.out.print(e);
}
}
public static int ff(int[] a,int c){
if(c==0) return a[0];
else return a[c]+ff(a,c-1);
}
}