Oracle Certified Associate Java Se 8 Programmer · Free Practice Question Easy

Question 14

What will be the result of compiling and executing Test class?

  • A

    Output is: (10 != 5)

  • B

    Output is: false

  • C

    Compilation error

  • D

    Output is: true

Reveal correct answer

Correct answer: D

Explanation

"Output is: " + (10 != 5) [Nothing to evaluate at left side, so let's evaluate the right side of +, 10 != 5 is true.] 

= "Output is: " + true [+ operator behaves as concatenation operator] 

= "Output is: true"

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need