Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
output clarification
m prabhu
Ranch Hand
Posts: 79
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
System.out.format("%s", new Long("123"));
will it compile and run without exception.please explain the result.
Milan Sutaria
Ranch Hand
Posts: 122
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 79
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class Trial { public static void main(String[] args){ System.out.format("%s", new Long("123")); } }
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
Posts: 8
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What
Java
version do you have? The class PrintStream has the method format() in java 5.
Sandeep Bhandari
Ranch Hand
Posts: 201
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Netscape7.1 and window.createPopup()
Why we live?
input type=file
onload
build.xml question
More...