aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes output clarification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "output clarification" Watch "output clarification" New topic
Author

output clarification

m prabhu
Ranch Hand

Joined: Jan 29, 2008
Posts: 79


will it compile and run without exception.please explain the result.
Milan Sutaria
Ranch Hand

Joined: Jul 10, 2008
Posts: 122
how about running it?
answer is ... yes it will run without any error. '%s' invokes the toString() method on the object & so the output will be 123
[ July 22, 2008: Message edited by: Milan Sutaria ]

SCJP 6 83%
Working on SCWCD/OCPJWCD
m prabhu
Ranch Hand

Joined: Jan 29, 2008
Posts: 79


when compiled:giving the following error.

symbol : method format(java.lang.String,java.lang.Long)
location: class java.io.PrintStream
System.out.format("%s", new Long("123"));
1 error

Please explain
Denis Bogdanov
Greenhorn

Joined: Jul 10, 2008
Posts: 8
What Java version do you have? The class PrintStream has the method format() in java 5.
Sandeep Bhandari
Ranch Hand

Joined: Apr 16, 2004
Posts: 201
Use the same version of java as the one of the exam for which you are preparing


SCJP 96% | SCWCD 90%| SCJP mock exams | My SCJP blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: output clarification