Multiple choice

What is the output of the following?

public void test(){int x=0;if(x){System.out.println(false);}else{System.out.println(true); }}

  1. Prints false

  2. Prints true

  3. Runtime error

  4. Compilation error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Expression given in if statement should result in boolean value.