Given the definitions of the MyString class and the Test class:
What is the result?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Given the definitions of the MyString class and the Test class:
What is the result?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Answer: C
package q065;
class MyString {
String msg;
MyString(String msg) {
this.msg = msg;
}
}
package q065;
public class Test {
public static void main(String[] args) {
System.out.println(“Hello “+ new StringBuilder(“Java SE 8”));
System.out.println(“Hello “+ new MyString(“Java SE 8”));
}
}
Output:
Hello Java SE 8
Hello q065.MyString@15db9742
C
C