resolved: Is there something new with printf()/ [message #926753] |
Fri, 28 September 2012 19:59  |
Eclipse User |
|
|
|
I took several Java programming classes six and seven years ago. When I got a job six+ years ago, they didn't use Java. So, now I am trying to refresh my knowledge of Java using the textbook from seven years ago.
One of the example programs has the following command:
System.out.printf( "%-8s\t", metaData.getColumnName( i ) );
Now, when I enter this program, I get the following message:
"The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, Object)"
Even a simple command like "System.out.printf( "%s", "cow" );" returns the above error.
Please help me determine what I'm missing.
Thanks,
Gregory
[Updated on: Mon, 01 October 2012 00:11] by Moderator
|
|
|
Re: Is there something new with printf()/ [message #928482 is a reply to message #926753] |
Sun, 30 September 2012 13:22   |
Eclipse User |
|
|
|
On 09/28/2012 05:59 PM, Gregory Hansen wrote:
> I took several Java programming classes six and seven years ago. When I
> got a job six+ years ago, they didn't use Java. So, now I am trying to
> refresh my knowledge of Java using the textbook from seven years ago.
>
> One of the example programs has the following command:
>
> System.out.printf( "%-8s\t", metaData.getColumnName( i ) );
>
> Now, when I enter this program, I get the following message:
>
> "The method printf(String, Object[]) in the type PrintStream is not
> applicable for the arguments (String, Object)"
>
> Even a simple command like "System.out.printf( "%s", "cow" );" returns
> the above error.
>
> Please help me determine what I'm missing.
>
> Thanks,
> Gregory
This forum is really for answering questions about Eclipse, the Eclipse
workbench, etc. and not for answering general Java questions. You'll
find better and more dedicated help for this at javaranch.com,
stackoverflow.com, etc.
|
|
|
Re: Is there something new with printf()/ [message #928910 is a reply to message #928482] |
Mon, 01 October 2012 00:09  |
Eclipse User |
|
|
|
Russell,
Apparently this is a "feature" of newer Java SDKs, but I'm too green to talk to that point.
I don't know about other IDEs, but in Eclipse I fixed this as follows:
Right click on the project.
Select Properties.
In the Properties for <project name> dialog, select Java Compiler on the left.
In the Java Compiler settings (on the right), un-check Use compliance from execution environment 'J2SE-1.4' on the 'Java Build Path'.
For the Compiler compliance level:, I selected 1.7.
Click OK.
I hope nobody else needs this, but in case someone does, hope this helps.
Gregory
|
|
|
Powered by
FUDForum. Page generated in 0.25639 seconds