In Java, I understand that whenever we print object reference, internally toString() will be called. By default, toString() will print in this format "classname@hashcode". If this is true, then the following snippet should raise Null Pointer exception. Why does it not happen?
int[][] a = new int[3][];
System.out.println(a); --> Prints [a@xxxxx
System.out.println(a[0]); --> Prints null (It should have thrown Null pointer Exception?)
Could some one help me understand this?