In the following code example:
class Parent { int x =5; public Integer aMethod(){ System.out.print(\"Parent.aMthod \"); return x;
Operations are always on Objects. In both cases, p.aMethod() and c.aMethod(), object is child that is why it printed 6 in both cases. When you directly access variable directly it reads variable associated with left side.
p.aMethod()
c.aMethod()