Oracle Certified Professional Java Se 11 Developer · Free Practice Question Easy

Question 5

Question ID: UKOCP38050


Consider below code of Test.java file:


What is the result of compiling and executing Test class?

  • A 0
  • B 1
  • C true
  • D false
  • E Compilation error
Reveal correct answer

Correct answer: E

Explanation

UKOCP38050: In Java language, boolean type can store only two values: true and false and these values are not compatible with int type. Also + operator is not defined for boolean types. Hence, all the 3 statements inside main method causes compilation error.

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