Polymorphism means that the behavior an object exhibits will change depending on the
type of the object and the operands the object employs.
The idea of polymorphism is that each class/object knows how to do its own behavior.
Different classes may have the same type of behavior but they each accomplish the
behavior in their own way. A general description is, many meanings or shapes.
For example, two persons have the behavior of what they think about the clothes they
wear. One person may be very fashion oriented and thus dresses accordingly. Another
person has the same behavior of dressing but their fashion sense may be very utilitarian
so they wear a plain uniform.
Overriding
Overriding applies to methods in an inheritance relationship. A child object can
override the method implementation of a parent object by specifying the same
method signature (method name and argument list) in the child object. The meaning
is dependant on the class/object where the method is defined and it follows the
inheritance structure. Therefore superclass can have a method, that the
subclasses modify, if need be adding their own specific implementation.
Overloading
Overloading is the concept of applying multiple meanings to an operation with the
same name. The operation being overloaded must be a method, since Java does not
allow operator overloading. One operator is overloaded for us, the + sign, which
performs addition and concatenation.
Meaning is dependant on the arguments or parameters that are passed to the method.
With method overloading, the same method name is used but the other parts of the
method signature (parameter or argument lists) are different. Depending on the
types, number of and order of arguments passed to the method name, the actual
method name and parameter list that matches the calling specification will be
selected to be called. Notice that all of the overloaded methods are in the same
class. If they were not in the same class, ie in a subclass, we would have
overriding.
Abstract Keyword
The abstract keyword is used to signify that a superclass will have subclasses,
which will implement the abstract methods of the class. The keyword is used
in the following manner:
public abstract class ClassName {
public abstract ReturnType methodName();
}