What is runtime polymorphism or dynamic method dispatch

What is runtime polymorphism or dynamic method dispatch

Answer:

  • 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.

Leave a Reply

Your email address will not be published. Required fields are marked *