
帮忙看一下这个编程怎么编啊!(我是非专业Java学生)希望有专家能帮我解答一下,谢谢啦!
关注结果如下:


public class Test {
static class Faction {
private Integer n;
public Faction(int n) {
this.n = n;
}
public void show(){
System.out.println(n+"的阶乘是:"+factorial(n));
}
public Integer factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n - 1);
}
}
}
public static void main(String[] args) {
Faction faction=new Faction(5);
faction.show();
}