This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes println(String x) unnecessary ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "println(String x) unnecessary ?" Watch "println(String x) unnecessary ?" New topic
Author

println(String x) unnecessary ?

Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
It is fine that the println method of PrintStream is overloaded for each primitive types and also the Object reference. But why do we need another overloaded println method for String when we already have one for Object ? I understand that String is an Object in Java.
Doesn’t
void println(Object x)
make
void println(String x)
unnecessary ?
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
There is a call x.toString() in println(Object x) that is not needed in println(String x)
A little speed gain, or for completeness?


SCJP2. Please Indent your code using UBB Code
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: println(String x) unnecessary ?
 
It's not a secret anymore!