so i cant run even such a simple code suddenly:"
public class Test {
public static void main (String [] args)
{
int i=6;
System.out.println("this is i: %d" ,i);
}
}
didnt work with printf either. same goes for format...etc.
the error im getting is this: Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method println(int) in the type PrintStream is not applicable
for the arguments (String, int) at examples.Test.main(Test.java:7)
I dont know what went wrong with the compiler... should i just re instal the eclipse?
System.out.println accepts only one argument (of any primitive type, String, Object or array of char) and can't print formatted text. You should use printf instead:
System.out.printf("this is i: %d\r\n" ,i);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With