n 的阶乘(假设n不为0) public static int getResult(int n) throws ValidationException { if(n<=0){ throw new ValidationException("非法参数"); } if(n==1){ return 1; } return getResult(n-1)*n; }