OCA Java SE 8 Mock Exam Review - OCA Mock Question 38








Question

What is true about the following lines of code?

boolean b = false; 
int i = 9; 
System.out.println(i >= b); 
  1. Code prints true
  2. Code prints false
  3. Code prints 90 >= false
  4. Compilation error




Answer



D

Note

The code fails to compile since we can't compare incomparable types, such as a boolean value with a number.