Polymorphism in Java Tutorial | Difference between static and dynamic Polymorphism in JAVA
Polymorphism in java : Brief introduction
Polymorphism in java is an important concept.
Polymorphism is an OOP concept and it is not really related to the java language.
It is a compound term:
Poly: means many
Morphs: means forms
There are two types of polymorphism :
- Static polymorphism
- Dynamic Polymorphism
Static polymorphism in java
This type of polymorphism is implemented in java using method overloading.
Method overloading is achived inside the same class.
It consists in defining many methods having the same name and different parameters list.
I suggest to check this tutorial to know what is method overloading in java.
Dynamic polymorphism in java
This type of polymorphism is implemented using method overriding in java.
The concept of method overriding is tightly related to the java inheritance principle.
You can check this tutorial to know more about this concept.
You can check this java polymorphism tutorial which has many examples and is very
interesting.
Good Resources for the polymorphism principle
I suggest to check those tutorials for more informations about the polymorphism concept:
1) http://how-to-program-in-java.com/2016/08/17/polymorphism-java-examples-static-dynamic/
2) https://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html