Multiple choice technology

What is the output of the following program? class example { public static void main(String args[]) { int j; do { j++; } while(j < 0); System.out.println(j); } }

  1. The program does not compile as j is not initialized

  2. The program compiles but does not run

  3. The program compiles and runs but does not print anything

  4. prints some value

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

Local variable 'j' is used without being initialized - in Java, local variables must be explicitly initialized before use. The 'j++' operation in the do-while tries to increment an uninitialized variable, causing a compile-time error. This is different from instance variables which get default values.