A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Programmer Certification (SCJP/OCPJP)
Joined: Mar 30, 2004
Oct 01, 2004 08:41:00
Long l=new Long("127");
When ever toString() method is called on a object a new
object is created or i m missing some thing.
"The will to win is worthless if you do not have the will to prepare"
Joined: Aug 25, 2004
Oct 01, 2004 09:01:00
u r right !
l.toString()==l.toString() creates two new strings where in case the == returns false.
Joined: Aug 03, 2002
Oct 01, 2004 09:04:00
If == returns false when comparing two objects then they are different objects. So the answer is yes; Long.toString() returns a new unique String instance each time its called.
Ask a Meaningful Question
Getting someone to think and try something out is much more useful than just telling them the answer.
It is sorta covered in the
JavaRanch Style Guide
Oh jeez, total newbie question.
Reading a String backward
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015