Why java complains about
// int i;
if( i == null ){ }
and not about
// Integer i;
if( i == null ){ }
Because int is a primitive type , while Integer is its wrapper class .
Said differently, int is a value type (and as such cannot be null) while Integer is a reference type (and as such can be null).
In Java, every primitive type (such as boolean, double or char) is a value type. Since primitive types do not inherit from Object, a set of "wrapper classes" is offered (Boolean, Double, Character to name a few) when such behavior is needed (like, for instance, putting them in containers, or using them as generic type parameters).
The result is that primitive types really are second class citizens in Java.