public class JavaApplication1 { 
    public static void main(String[] arg) {        
          System.out.println(methld(5));        
    }
    public static int methld(int n){
           if(n == 1){ return 1 ;}       //这两行提示有问题 什么原因啊!      
           else return n*methlod(n-1);     //     
     }
     
}     求指点!

解决方案 »

  1.   


    public class JavaApplication1 {
    public static void main(String[] arg) {
    System.out.println(method(5));
    } public static int method(int n) {
    if (n == 1) {
    return 1;
    } // 这两行提示有问题 什么原因啊!
    else
    return n * method(n - 1); //
    }
    }一个全角半角问题,一个名字写错了。。
      

  2.   

    两个错误:
    1,if后面的括号使用的是中文打出来的,改成英文的
    2,return n*methlod(n-1);//这里的methlod多了个o,你的方法名是methld
      

  3.   

    程序逻辑是没有错误的,(n == 1)的括号应该改为英文的(n == 1);
    else return n*methlod(n-1); 中方法名错了应该为  methld;
    把这两处改好就行了! 
      

  4.   

    不会死循环吗?
    System.out.println(methld(-5));