Hey Lucky,
Unboxing is a funda in
java in which compiler identifies that when the programmer is trying to assign a wrapper to premitive type, it calls the corresponding function to return the premitive type. (As Integer.intValue() in case of integer)
The java compiler converts your code to the code as mentioned below.
In this function, at runtime the interpreter tries to call x.intValue(). As we know that the value of x is null. so It returns null pointer exception.
I hope this would clear your confusion.