The Method Printf(String, Object[]) in the Type Printstream Is Not Applicable for the Arguments (...)

The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (...)

Check that the Compiler compliance level is set to at least 1.5 for your project:

Project > Properties > Java Compiler

if Enable project specific settings is not set, use the Configue Workspace Settings... link on that page to check the global Compiler compliance level.

Sample Image

Eclipse Java printf issue PrintStream is not applicable

Turns out the project folders in Eclipse run on their own properties seperate from the Eclipse main settings .. in order for them to compile on version 1.6/1.7/1.8 you have to change their properties seperatly from the main settings...

Basically instead of going to windows > preferances ... to change and update the compiler version you right click on the project folder in Package Explorer > Properties > Java Compiler then check the Enable project specific settings and then Change the settings below to the compiler compliance level of 1.5 or higher in order for this code above to work.

Why it does that i have no idea makes no sence but it at least works now :)

The method println(int) in the type PrintStream is not applicable for the arguments (String, int, int, int)

Try

System.out.println(num1+" x "+num2+" = "+result+"\n");

UPDATE: Some of you are saying this concatenation method is slower than other methods. You are right, it is slower, but does it really matter for this example?

This method is usually used to debug, not as part of the final code, and usually only once or twice on the whole code.

Faster method:

System.out.printf("%d x %d = %d\n",num1,num2,result);

Java: printf is not applicable for the arguments (String, double)

Is it possible that you hav Java compiler compliance level 1.4?



Related Topics



Leave a reply



Submit