Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: clarified: private methods cannot be hidden

...

Wiki Markup
Note that "In a subclass, you can overload the methods inherited from the superclass. Such overloaded methods neither hide nor override the superclass methods—they are new methods, unique to the subclass." \[[Tutorials 08|AA. Java References#Tutorials 08]\]

Wiki Markup
Technically, a private method cannot be hidden or overridden. There is no requirement that private methods with the same signature in the subclass and the superclass bear any relationship in terms of having the same {{throws}} clause, a necessary condition for _hiding_. \[[JLS 05|AA. Java References#JLS 05]\]

Risk Assessment

Confusing overriding and hiding can produce unexpected results.

...

Wiki Markup
\[[Tutorials 08|AA. Java References#Tutorials 08]\] [Overriding and Hiding Methods|http://java.sun.com/docs/books/tutorial/java/IandI/override.html]
\[[Bloch 05|AA. Java References#Bloch 05]\] Puzzle 48: All I Get Is Static
\[[JLS 05|AA. Java References#JLS 05]\] 8.4.6.3 Requirements in Overriding and Hiding

...

09. Methods (MET)      09. Methods (MET)      MET01-J. Follow good design principles while defining methods