You are not overriding anything here... You just defined a function in class Child
called getActivity()
, which is distinct and hides the function getActivity()
in class Parent
.
UPDATE: From this question:
that doesn't mean it is overriding. In this case, it's the rules in section 8.4.8.3 of the JLS, "Requirements in Overriding and Hiding":