On object of child class, static methos of super class are available but when we define same method in child class, now object of child class start pointing to child class met
Since A
extends B
, an instance of A
(which you create by calling new A()
) will have all methods, which B
has. Therefore, if you call .method()
on an instance of A
, the VM looks for a method()
first in its own scope, i.e. the dynamic methods within A
, then the dyanmic method within B
, then the static methods within A
and finally the static methods within B
. This is possible because the VM allows accessing static methods via a this
reference, although this is discouraged since it compromises readability.