Polymorphism is one of the characteristics of object oriented programming. Poly means many and Morph means :-
Overriding of a method is nothing but smooth modification of a method that is inherited from super class by it’s subclass. So it’s like smooth change or modification of the method of the superclass.
So, from this above definition we are quite clear that, overriding of method is one form of Polymorphism only. Please look at the below mentioned example:-
Here Accelerate method of the Car (Super class) is overridden by it’s Subclass FORD. So All the cars may have a default acceleration behavior but for Ford it may be different and the same is applicable for the Porsche also. So in the Porsche and Ford class the Accelerate method will be overridden which is a form of Polymorphism only. As the methods signature is same in all the classes but their behavior is completely different. Please find the Java code as mentioned below.
As mentioned, the Accelerate method is Overridden in Porsche class which is a form of Polymorphism only.