Community
Participate
Working Groups
Build ID: 3.3.0 Steps To Reproduce: 1.System.out.printf("%d items at $%.2f each.%n", count, price); 2. public class PrintfDemo { public static void main(String[] args) { String aString = "abc"; System.out.printf("%s %n", aString); } } These codes runs fine on all other platforms but gives a compilation porblem in eclipse. More information: Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int, double) The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, double) The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, double)
Are you building and running against different JRE's? What JRE is on your build path, and what JRE is on your runtime classpath?
Surely a problem of compliance. printf is implemented on PrintStream only since JRE 1.5, so set the project/workspace compliance at level 1.5 at least and your problem should disappear. Please reopen in case this was not the reason of your problem, thanks
Not sure to have been 100% clear... Of course, you also should change the project's JRE accordingly (ie. select at least a 1.5 one...)
Verified for 3.4M1