这样写为什么不行
import java.awt.*;import javax.swing.*;
public class Recursive{
String outPut;
public static void main(String[] args){
for(long counter = 1;counter <= 10;counter++)
System.out.println(counter + "! =" + factorial(counter) + "\n");
}
public long factorial(long n){ //不能调用静态方法
if(n <= 1)
return 1;
else
return n * factorial(n - 1);
}
}