[Edited : Punit explanation clears all doubt, He actually post the implementation of Of Byte#toString() object !! Great work !]
Originally posted by Ganeshkumar cheekati:
toString() method returns the object which is already exists
Nope, toString() returns an meaningful string about an object .
[See
Java Docs, for toString() default implementation]
Originally posted by Ganeshkumar cheekati:
so here object for Byte is returned
No, Its return the String object..
Originally posted by Ganeshkumar cheekati:
== operator is used tocheck whether both are pointing the same object or not..
why the answer is C
Right, so as both returned string represent the same object,
b1, they print "True"..
[== operator checks for equality of object reference, byte by byte , and it returns String from String Constant Pool]
HTH,
[ December 19, 2008: Message edited by: Sagar Rohankar ]