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
到底在哪里出问题了!?
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
到底在哪里出问题了!?
public static void main(String[] args) { // 没有主函数是没法运行的
int n = 3;
for (int i = 0; i< n; i++) {
System.out.println("Hello");
}
}
}
也可以的:
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);
}
}
}
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);
}
}
}