| 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: 118
|
|
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
|
 |
 |
|
|
subject: output clarification
|
|
|