[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: java Printstream printf()

Well try to press ctrl+space to bring content assist
and you'll see there are 2 printf methods

1. printf(Locale, String , Object[])
2. printf(String, Object[])

that's why you get Ex

> Justin Loh wrote:
I have tried to use java printf (available in jdk1.5.0_02) in the following program:

//Fig 2.6: Welcome4.java
// Printing multiple lines in a dialog box.

public class Welcome4
{
// main method begins execution of Java appliation
public static void main(String args[])
{ System.out.printf("%s\n%s\n", "Welcome to ", "Java Programming"); } // end method main
} //end class Welcome4


It compile fine when I compile it in cmd window using javac.exe. But when I tried it in Eclipse, it did not compile giving an exception message:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, String, String)

Can anyone help?

Rgds,
Justin Loh