Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » resolved: Is there something new with printf()/(The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, Object))
resolved: Is there something new with printf()/ [message #926753] Fri, 28 September 2012 23:59 Go to next message
Gregory Hansen is currently offline Gregory HansenFriend
Messages: 2
Registered: September 2012
Junior Member
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 04:11]

Report message to a moderator

Re: Is there something new with printf()/ [message #928482 is a reply to message #926753] Sun, 30 September 2012 17:22 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3245
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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 04:09 Go to previous message
Gregory Hansen is currently offline Gregory HansenFriend
Messages: 2
Registered: September 2012
Junior Member
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

Previous Topic:Testing new versions of a class
Next Topic:How to install Paho ?
Goto Forum:
  


Current Time: Mon Nov 24 21:52:47 GMT 2014

Powered by FUDForum. Page generated in 0.02678 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software