posted 19 years ago
I don't see the difference between these two choices:
a private method can never be overridden to become public.
a private method cannot be overridden and made public.
In both cases, since private methods can't be inherited by a subclass and are not visible from within a subclass, private methods can't be overridden in a subclass.
A method in a subclass with the same signature (name and parameters) as a private method in a superclass defines a new method altogether. The subclass method can only be invoked on a subclass reference, including this within the subclass, while the private superclass method can only be invoked from within the superclass.
I don't think super within the subclass can be used to call a private superclass method because that method is not visible from inside the subclass, but I haven't tried this.
[ December 24, 2004: Message edited by: Mike Gershman ]
Mike Gershman
SCJP 1.4, SCWCD in process