Possible Duplicate:
Static fields on a null reference in Java
I am new to Java. I know if any object point to and if we try to perform any operation on that object, a Nullpointer exception is thrown by JVM. But in my case there is no Nullpointer exception please help me ?. Below is my code
public class Employee
{
public static String empName = "John"
public static void main(String args[])
{
Employee emp = new Employee();
emp = null;
System.out.println(emp.empName);
}
}
It prints John as output even emp object is pointion to null. But I am expecting a nullpointer exception.