For some reason, in Eclipse, I get the error "change type of 'i' to 'Object[]'" for the "format" here:
int i = 461012;
System.out.format("The value of i is: %d%n", i);
I experience this error with JDK 7 and 8 (I tried reinstalling both in turn, and I tried the latest eclipse download, just to be safe).
I'm very confused as to why I can't use an int here. This example comes directly from the Oracle documentation for format. printf gives the same error.
Something so simple should be robust and reliable, one would think.
ON EDIT:
Sorry, here's the entire code that doesn't work for me.
public class Main {
public static void main(String[] args) {
int i = 461012;
System.out.format("The value of i is: %d%n", i);
}
}
And here's exactly what I see in Eclipse when I hover over "format" with the mouse:
The method format(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)
1 quick fix available:
Change type of 'i' to 'Object[]'.
Does that help?