What is runtime polymorphism or dynamic method dispatch
- Dynamic or Run time polymorphism : This kind of polymorphism existed at run-time. Java compiler does not understand which method to called at compile. Only JVM decides which method is to be called at run-time.
Method overriding is example of Dynamic or Run time polymorphism because method binding between method call and method definition happens at run time and it’s depend on the object of the class (when object create at run time and goes to heap) .
- Dynamic method dispatch : Dynamic method dispatch is a technique through which a call to an overridden method is resolved at run time.