OOP - Polymorphism Concepts

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Object-oriented software Design and Implementation (ADIT)

Polymorphism concepts

Write a Java program to explain the concepts of Polymorphism in details.

Polymorphism is the ability to incorporate adaptability of an object to take more than one forms
but the object remains same.
There are two methods of polymorphism in Java. From the implementation point of view, the
polymorphism for the methods is obtained by using the overload and override of the methods
themselves.

Overload: a method where more than one method shares the same name with different
parameter of signature and different return type.
Override: it is based on the writing of several methods identified by the same name which
however have, as input, parameters of a different type and number. Therefore, override means a
real rewriting of a certain method of a class that we have inherited.
Example:

You might also like