Menu
Topics Index
...
`


Object Oriented Concepts - Revisited >
Siva Nookala - 03 Mar 2017
Polymorphism meaning "many forms" helps in making the same action produce different results.

In a bike which supports both normal brakes and disc brakes, if we got only the normal brakes installed. At a later stage the normal brakes are replaced with the disc brakes. The way you applied the brakes before and after the replacement is not different, but how the bike responds to your action is different. This is a good example of polymorphism.

Similarly when we write a theory exam and is submitted for evaluation. Although not very much different, the marks you might get will be dependent on the person who is correcting it. The way you have written the exam is same, but the marks you get is dependent on who is correcting it. This is another example of polymorphism.

While we don't want different results in the case of examination, we definitely want the bike to behave differently.

The program in Run Time Polymorphism In Java shows how polymorphism can be implemented using Method Overriding In Java. Although we are calling the same method print, the output is different depending upon the object we are currently referring to.

Dependent Topics : Inheritance In Java  Run Time Polymorphism In Java  Method Overriding In Java 

0
Wrong
Score more than 2 points

© meritcampus 2016 - 2017

All Rights Reserved.