Leave a Reply 6

Your email address will not be published. Required fields are marked *


Alok Singh

Alok Singh

C

Alok Singh

Alok Singh

i mean answer is C which is option B.

Bob

Bob

Answer is B. Option C. The StringBuilder class does not override the toString(). It uses the object method.

vg

vg

Ans B option C

from javadoc
toString
public String toString()
Returns a string representing the data in this sequence. A new String object is allocated and initialized to contain the character sequence currently represented by this object. This String is then returned. Subsequent changes to this sequence do not affect the contents of the String.
Specified by:
toString in interface CharSequence
Returns:
a string representation of this sequence of characters.

Tomas

Tomas

Answer: B (option C)

output:
Hello Java SE 8
Hello p1.MyString@15db9742