递归就是A方法调用A方法,自己调用自己
public static void main(String[] args) {标签:调用,return,递归,int,static,public From: https://www.cnblogs.com/twz1015/p/17233018.html
System.out.println(f(5));
}
public static int f(int n){
if (n==1){
return 1;
}else {
return n*f(n-1);
}
}
f(5)>f(4)>f(3)>f(2)>f(1)=1再依次回去完成递归