exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 54 discussion

Actual exam question from Oracle's 1z0-808
Question #: 54
Topic #: 1
[All 1z0-808 Questions]

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

What is the result?
A.

B.

C.

D. Compilation fails at the Test class

Show Suggested Answer Hide Answer
Suggested Answer: C

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
iSnover
Highly Voted 1 year, 3 months ago
The correct one is the letter C and it has been tested. The reason for presenting the hashcode is because the MyString object does not have the to String method, whereas the Stringbuilder does, which is why it printed correctly.
upvoted 7 times
...
DriftKing
Most Recent 5 months ago
Answer is C. Code - class MyString { String msg; MyString(String msg) { this.msg=msg; } } // Since both classes are in same package 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")); } }
upvoted 2 times
...
Ankit1010
11 months, 4 weeks ago
Correct Answer is C
upvoted 1 times
...
UAK94
1 year, 3 months ago
Answer is C. Tested.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago