Multiple choice technology programming languages

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. 0

  2. Compile with error

  3. null

  4. NullPointerException

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

Attempting to unbox a null Integer reference to a primitive int throws a NullPointerException. This happens at runtime during the assignment 'int j = i' because Java cannot convert null to a primitive value. Option A is incorrect (null doesn't become 0), and B is wrong because this compiles fine but crashes at runtime.