exam questions

Exam 1z0-829 All Questions

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

Exam 1z0-829 topic 1 question 18 discussion

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

Given the code fragment:

What is the result?

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

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
xplorerpj
7 months, 1 week ago
Selected Answer: D
D is correct answer
upvoted 1 times
...
c6437d5
10 months, 2 weeks ago
Selected Answer: D
D tested correct
upvoted 2 times
...
Bharadwaj240796
11 months, 4 weeks ago
Option D. true:false:false:false is correct!!
upvoted 1 times
...
testostaws
1 year ago
Prints  true:false:false:false The first comparison is true because myStr and myTextBlk1 are equal (text block doesn't include trailing new lines if there is no content after the last quote). The second and third comparisons are false because myTextBlk2 includes a newline character at the end, making it different from myStr and myTextBlk1. The last comparison is false because, despite interning, myTextBlk1 and myTextBlk2 are not equal due to the newline character in myTextBlk2.
upvoted 1 times
...
supersquax
1 year ago
right option is D. copy paste into https://editor.javadevjournal.com/java-17-compiler.html and see for yourself: public class Main{ public static void main(String[] args){ String myStr = "Hello Java 17"; String myTextBlk1 =""" Hello Java 17"""; String myTextBlk2 =""" Hello Java 17 """; System.out.print(myStr.equals(myTextBlk1)+":"); System.out.print(myStr.equals(myTextBlk2)+":"); System.out.print(myTextBlk1.equals(myTextBlk2)+":"); System.out.println(myTextBlk1.intern() == myTextBlk2.intern()); } }
upvoted 2 times
...
meltedolive
1 year ago
right option is D.
upvoted 2 times
...
Tojose
1 year ago
I think the right option is C. true:false:true:true
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