Why is a null reference exception not thrown when I try to print the value of a static field value from an uninitialized instance of a class.
I expected a Null reference exception in the following code:
public class Check {
static int i=1;
public static void main(String []args)
{
Check ch = null;
System.out.print(ch.i);
}
}
Produces output as: 1.