Multiple choice technology web technology

What is the output for the below code ? public class Test { public static void main(String[] args) { Integer i = null; int j = i; System.out.println(j); } }

  1. NullPointerException

  2. 0

  3. Complie with Error

  4. Null

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

When unboxing a null Integer reference to a primitive int, Java throws NullPointerException at runtime. The code compiles successfully because the assignment is syntactically valid - the error occurs during execution when the JVM tries to extract the int value from null.