Can a private method of a superclass be declared within a subclass?
The answer given is YES and explanation says that "Private methods cannot be overriden, but they can be re-declared/redefined in the subclass..." OK, but the question was about declare, not about re-declare. For me they are different terms. I think that method (whether private or not) may be declared only once (in the class in question or somewhere higher in the inheritance hierarchy). When talking about subclass, what you can do (or try to do) is re-declaring, overriding, "declaring method with the same signature as in superclass", ... but you cannot say that you are "declaring method of a superclass". Am I missing something? Comments anybody?
-- Y. Sforza
Joined: Aug 26, 2001
To be 100% JLS compliant the wording should be something like this: "Can a subclass declare a method that has the same signature than a private method in its superclass?" Note that the access modifier is NOT part of the signature of a method.