exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 168 discussion

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

Given the code fragment:

Which code fragment, when inserted at line n1, enables the App class to print Equal?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
DriftKing
3 months, 3 weeks ago
Selected Answer: B
Tested. B
upvoted 1 times
...
carloswork
1 year, 2 months ago
Selected Answer: B
Answer is B. To test: public static void main(String[] args) { String str1 = "Java"; String str2 = new String("java"); if(str2.equals(str1.toLowerCase())) //line n1 { System.out.println("Equal"); } else { System.out.println("Not Equal"); } }
upvoted 1 times
...
iSnover
1 year, 3 months ago
Selected Answer: B
The answer is letter B, you can finish by eliminating the others that are very wrong. There's no way to be A or C because the first line of the 2 answers makes an operation useless because String is immutable, you would have to assign the operation to a variable. The letter D is wrong because you don't compare a String with "==", because String is not a primitive variable and even being equal it will give false, to get around this you have to use the "equals" method that will compare the substrings of the String, which is what is done in answer B.
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