public class Text3{
public static void nPrintln(String message,int n){
for (int i = 0; i< n; i++)
System.out.nPrintln("Hello",3);
}
}
jdk总是在System.out.nPrintln("Hello",3);这个地方打叉
我想输出三遍hello 
到底在哪里出问题了!?

解决方案 »

  1.   

    主函数错误,拼写错误,函数参数错误以及大小写错误,修改下:public class Text3{
      public static void main(String[] args) { // 没有主函数是没法运行的
        int n = 3;
        for (int i = 0; i< n; i++) {
          System.out.println("Hello");
        }
      }
    }
      

  2.   

    如果用nPrinln("Hello",3)来写是怎样的呢!?
      

  3.   


    也可以的:
    public class Text3{
      public static void main(String[] args) { // 没有主函数是没法运行的
        nPrinln("Hello",3); // 调用自定义的函数
      }
      public static void nPrinln(String message, int n)
        for (int i = 0; i< n; i++) {
          System.out.println(message);
        }
      }
    }
      

  4.   

    漏了个左括号,见谅:
    public class Text3{
      public static void main(String[] args) { // 没有主函数是没法运行的
        nPrinln("Hello",3); // 调用自定义的函数
      }
      public static void nPrinln(String message, int n) { // 刚才漏了这个左括号
        for (int i = 0; i< n; i++) {
          System.out.println(message);
        }
      }
    }
      

  5.   

    楼主的代码写的有问题 System.out.nPrintln("Hello",3); 建议去看一下api,什么是System,什么是out,println()又是哪个类的方法,把这些弄清楚,就自然明白了。还有你的程序没有main()方法,怎么执行呢?