08.08. Polymorphism

Polymorphism

  • Eclipse: Oxygen
  • Java: 1.8

This tutorial deals with the concept of polymorphism. Polymorphism in simple words means to have multiple forms of a single entity.

In the previous example when a note8 object call features methods by different scopes (class scope, one of Phone and one of SamsungNote8) we obtain different outputs.

 

 

 

Output

Andriod flagship
Nokia 3310
Feature phone

Here another such example of the same function depicting a different output when referenced by the object of the different class is shown.

Here the same example as above is taken in an altogether different function outside the main function which has a return type of Phone class.

 

Output

3310
Feature phone
Note 5
Andriod flagship

Contributed by: Poonam Tomar

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments