我不能在这段代码中犯一个错误(JAVA) [英] I cant fin a mistake in this code (JAVA)
本文介绍了我不能在这段代码中犯一个错误(JAVA)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,请帮我在这段代码中发现错误。 Thnaks
Hello, please help me find a mistake in this code. Thnaks
package program_1;
import java.util.Scanner;
public class basic_class {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String [] array = new String[4];
for (int i = 0; i < array.length; i++){
System.out.printf("Zadaj meno %i. uzivatela", i);
array[i] = in.nextLine();
write_all_names (array);
}
}
public static void write_all_names (String [] menaAr){
for (int i = 0; i < menaAr.length; i++){
System.out.println("1." + menaAr[i]);
}
}
}
我尝试过:
我什么都没试过。我认为代码是正确的,但Eclipse告诉我一些事情。
What I have tried:
I tried nothing. I think code is right but Eclipse tell me something worng.
推荐答案
这是关于阅读文档...
printf
格式化程序无法识别%i
作为格式化选项...您可能意味着%d
,但是......
Formatter(Java Platform SE 7) [ ^ ]
It is all about reading the documentation...
printf
formatter does not recognize%i
as a formatting option...You probably meant%d
, but...
Formatter (Java Platform SE 7 )[^]
这篇关于我不能在这段代码中犯一个错误(JAVA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文