Let's consider following code:
public static void main(String[] args) {
    Integer i = null;
    Object o = null;
    System.out.println(i);
    System.out.println(o);
    System.out.println(i.toString());
    System.out.println(o.toString());
}
That's quite obvious that last two prints will cause NullPointerException. One can't call method on null object. 
The question is why first two prints work? Aren't they calling toString() as well?
 
     
     
     
    