This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Overriding is the concept where a subclass will "re-implement" an inherited method to change the way in which that method works. The overriding method would have the same contract as the original method.
When you over load a method, you are provide alternative versions of the same method, but their contact most differ from each other. This can be seen in the wrapper classes for the primitive types. Can be seen in constructors where a number of constructors exist for a class.
overriding - inheritance is mentioned to it when a subclass whom to be more it specifies with the method of the superclassroom. overloading - you mention yourself to have metodos with name the same, more with different arguments.
1) overriding - you are completely replacing the inherited method within the subclass. When this method name is called using a reference to the new subclass object you get the subclass' version of the method. It MUST have the same parameter list and must return the same type EXCEPT that it MAY return a subclass of the overridden class' return type ( see covariant return)
2) overloading - you are adding an implementation of the superclass' method that deals with a different parameter type, a different parameter list, or a combination of those. Since it is a new method it can change the return type.
(edited to fix typo) [ August 08, 2007: Message edited by: Bob Ruth ]
SCJP - 86% - June 11, 2009