Overloading a method | Same name in the same class,
different signature.
"Different" is either the number or classes of the arguments. The correct one is called based on matching the arguments in the call to the expected parameters of the method. |
Overriding a method | Same signature coded in the child as the one
coded in the parent.
The correct one is called automatically. |
@Override
annotation tells the compiler that you mean to override an
inherited method. If it does not exists about your class in the hierarchy, you will get a compilation
error (remember, "The Compiler is your friend!").
For instance:
@Override
public String toString()
{
return(super.toString() + " the child's instance variables");
}