[英]System.out.printf not working with Integer
When I type this part of code below it gives me an error message next to the System.out.printf line. 当我在下面键入这部分代码时,它在System.out.printf行旁边显示一条错误消息。
It tells me that I should replace the Integer type for i
into Object[]
. 它告诉我应该将i
的Integer类型替换为Object[]
。
However in the tutorial I am following the part below works and doesn't give any error messages. 但是,在本教程中,我关注以下部分,但没有给出任何错误消息。 So is there something i did wrong here or what is the correct type then? 那么,我在这里做错了什么吗?或者什么是正确的类型呢?
for(int i=0; i < 5;i = i + 1) {
System.out.printf("The value of i is: %d\n", i);
}
You can get, and print its value, this way: 您可以通过以下方式获取并打印其值:
for(int i=0; i < 5;i = i + 1) {
System.out.printf("The value of i is: %d\n", Integer.valueOf(i));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.