0
 public class A {

     static int count = 10;
 }

 public class Test {

     public static void main(String[] args) {

       A a = null;
       System.out.println(a.count);
    } 
 }

Expected Output:

Null Pointer Exception.

Actual Output:

10

can anybody explain this, why it hasn't thrown null pointer exception rather it has printed the value of count?

0 Answers0