public class A { int i; int j; void funA() { i = i+1; System.out.println(i); j = j+1; System.out.println(j); } }
......................................................................
public class Demo<G> { G x; public static void main(String[] args) { Demo<A> d3 = new Demo<A>(); try { d3.x.i = 5;//why Null pointer Exception } catch (Exception e) { e.printStackTrace(); } } }
Ads