Polymorphism: It is the ability of an object reference to be employed as if it referred to an object with various forms. The polymorphism in Java outcomes from both class inheritance and interface inheritance. The actually different forms frequently outcome from the static type of the variable in which the reference is store-up. The following class header is as shown below:
class Rectangle expands Polygon implements Comparable
It is an object whose dynamic type is Rectangle and can behave as all of the types as: Rectangle, Comparable, Polygon, and Object.