程序老是报错 求解释
/** To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication4;
/**
*
* @author lihongshuai
*/
public class JavaApplication4 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int i=0;
math mymath = new math();
for(i=1;i<=20;i++) {
System.out.println(mymath.f(i));
}
// TODO code application logic here
}
class math
{
public int f(int x)
{
if(x==1 || x==2) {
return 1;
}
else {
return f(x-1)+f(x-2);
}
}
}
}