class A { int a = 2, b = 3; public void display() { int c = a + b; System.out.println(c); } } class B extends A { int a = 5, b =
There isn's anything called variable overriding. That is why you are getting the same result in both the cases.