public class Factorial {
static long fac(int n){
if(n==1)
return 1;
else
return n*fac(n-1);
}
public static void main(String[] args){
int k;
long f;
k=Integer.parseInt(args[0]);
f=fac(k);
System.out.println(f);
}
}
错误提示:Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at javaapplication1.Factorial.main(Factorial.java:21)
Java Result: 1