Question 54 of 76 from exam 1Z0-808: Java SE 8 Programmer I

Question 54 of 76 from exam 1Z0-808: Java SE 8 Programmer I

Question

Given the definitions of the MyString class and the Test class:

MyString.java

package pli
class MyString {
String msg;
MyString (string msg)
this.msg = msg;
3
}

Test.java

package pli
public class Test {

public static void main(string[] args) {

system. out. println ("Hello
system. out. println ("Hello

"+ new StringBuilder ("Java SE 8"));
"+ new MyString("Java SE 8"));

What is the result?

cA)

cB)

©)

© D)

Hello Java SE 8
Hello Java SE 8

Hello java. lang. stringBuilder@<<hashcodel>>
Hello pl.MyString@<<hashcode2>>

Hello Java SE 8
Hello pl.MyString@<<hashcode>>

Compilation fails at the rest class

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

C.