exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 77 discussion

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

Given:



What is the result?

  • A. hey oh hi
  • B. yo ey
  • C. A compile time error occurs.
  • D. oh hi hey
  • E. hey oh hi yo ey
  • F. hey oh hi ey
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

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
ASPushkin
1 month, 3 weeks ago
Selected Answer: E
The interesting thing here is the call sb2 from System.out.println() in method foo(); But thats ok because it happened in new StrBldr() context and sb2 is already assigned.
upvoted 1 times
...
d7bb0b2
1 year, 1 month ago
The correct answer is E. "hey oh hi yo ey" The foo method in the StrBldr class is called within the main method with a StringBuilder argument of "hey". Inside the foo method, it prints s ("hey"), " oh ", and sb2 ("hi "), then returns a new StringBuilder with "ey". After the foo method is called, the returned StringBuilder ("ey") is appended to sbl ("yo "). So, the final output of sbl is "yo ey". Therefore, the output of the program is the concatenation of the print inside the foo method and the print of sbl in the main method, which is "hey oh hi yo ey".
upvoted 1 times
...
tmuralimanohar
1 year, 6 months ago
Answer: E
upvoted 1 times
...
Stavok
1 year, 7 months ago
Selected Answer: E
E is correct 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