Given the definitions of the MyString class and the Test class: What is the result?
A.
Option D
B.
Option C
C.
Option B
D.
Option A
Given the definitions of the MyString class and the Test class: What is the result?
A.
Option D
B.
Option C
C.
Option B
D.
Option A
C
i mean answer is C which is option B.
Answer is B. Option C. The StringBuilder class does not override the toString(). It uses the object method.
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.
Answer: B (option C)
output:
Hello Java SE 8
Hello p1.MyString@15db9742
b