exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 36 discussion

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

Given the code fragment:

Which code fragment, when inserted at line 9, enables the code to print true?

  • A. String str2 = str1;
  • B. String str2 = new String(str1);
  • C. String str2 = sb1. toString();
  • D. String str2 = "Duke";
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
Mamlouk_Med
Highly Voted 5 years, 9 months ago
Correct Answer is A
upvoted 19 times
...
vic88
Most Recent 1 week, 6 days ago
Selected Answer: A
A is right
upvoted 1 times
...
Vicky_65
1 year, 8 months ago
Selected Answer: A
correct one is A
upvoted 1 times
...
Ankit1010
1 year, 10 months ago
A is the correct answer
upvoted 1 times
...
iSnover
2 years, 2 months ago
Selected Answer: A
The answer is letter A, even the string containing the content inside them as they are not considered equal, to "circumvent" this, we must instantiate the second String taking the first as a reference as "str2 = str1;" and with that we can print true with the boolean "str2 == str1".
upvoted 4 times
...
OnGodNoCap
2 years, 5 months ago
Selected Answer: A
The correct answer
upvoted 1 times
...
hexadecimal82
2 years, 5 months ago
Selected Answer: A
Answer is A not B !
upvoted 1 times
...
XalaGyan
2 years, 10 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
admin8
2 years, 12 months ago
Answer is A!!!
upvoted 1 times
...
reem3
3 years ago
Selected Answer: A
Correct Answer is A
upvoted 1 times
...
Anton2020
3 years ago
Selected Answer: A
if you want the object location in memory for two Strings to be the same, they need to be set equal with ==
upvoted 1 times
...
JongHwa
3 years ago
Selected Answer: A
A가 맞습니다.
upvoted 1 times
...
Yogesh_gavate19
3 years, 5 months ago
Correct A
upvoted 1 times
...
SSJ5
3 years, 8 months ago
Correct Answer is A
upvoted 1 times
...
akashgupta3852
3 years, 9 months ago
Option A
upvoted 1 times
...
Srivani
3 years, 9 months ago
A is the correct answer because == checks the reference equalities where as equals checks the character equality.
upvoted 2 times
...
mete23
4 years, 10 months ago
Correct Answer is A
upvoted 4 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