有一个没有解决的问题(初学者)
import java.lang.*;
public class j019
{
int obj=100;
public static void main(String[] args)
{
fac obj=new fac();
System.out.println("100阶乘="+obj.Fac(100));
}
}
class fac
{
public static long Fac(int x)
{
if(x<0)
{
throw new IllegalArgumentException("x must be > =0");
}
if(x>=2)
{
return x*Fac(x-1);
}
else
{
return 1;
}
}
}
这是我编的一个100的阶乘的小程序,经过反复修改,终于编译通过了,但运行结果却是0,不知为什么?请朋友多多指点,在这儿多谢了!