What is dynamic Method Dispatch? tccicomputercoaching.com

Page 1

What is dynamic Method Dispatch? tccicomputercoaching.com What is Method dispatch in Java? It is process of selecting implementation of polymorphic operation to call run time or compile time.

There are two types of Method dispatch or Binding in Java. 1) Static binding in Java This occurs during Compile time. Static binding also known as early binding or compile-time binding. Private, final and static methods and variables uses static binding and bonded by compiler 2) Dynamic binding in Java This occurs during Runtime. Dynamic binding is also known as late binding or runtime binding. Virtual methods are bonded during runtime based upon runtime object. Method overriding is one of the ways in which Java supports Runtime Polymorphism. Dynamic method dispatch is the mechanism by which a call to an overridden method is resolved at run time, rather than compile time. 



When an overridden method is called through a super class reference, Java determines which version (super class/subclasses) of that method is to be executed based upon the type of the object being referred to at the time the call occurs. Thus, this determination is made at run time. A super class reference variable can refer to a subclass object. This is also known as up casting. Java uses this fact to resolve calls to overridden methods at run time.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
What is dynamic Method Dispatch? tccicomputercoaching.com by Rosario Riley - Issuu