Follow Our FB Page << >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

what is dynamic method dispatch ?

Answers were Sorted based on User's Feedback

what is dynamic method dispatch ?..

Answer / penchala

Dynamic dispatch is a mechanism by which a call to
Overridden function is resolved at runtime rather than at
Compile time , and this is how Java implements Run time

Is This Answer Correct ?    87 Yes 5 No

what is dynamic method dispatch ?..

Answer / yayati pavan kumar

class A
public void m1()
class B extends A
public void m1()
A a=new B();//B reference will be assign at run time
a.m1();//class B method m1() will be called at runtime

Is This Answer Correct ?    79 Yes 18 No

what is dynamic method dispatch ?..

Answer / rashmi

Dynamic Method Dispatch is Run -time Polymorphism which is
Method Overriding.

Is This Answer Correct ?    72 Yes 15 No

what is dynamic method dispatch ?..

Answer / ravikiran

super class reference variable refering to a subclass object
is called dynamic method dispatch.

Is This Answer Correct ?    37 Yes 8 No

what is dynamic method dispatch ?..

Answer / arijit

Java uses this fact to resolve calls to overridden methods
at run time. Here&#8217;s
how. When an overridden method is called through a
superclass reference, Java determines
which version of that method to execute based upon the type
of the object being referred to at the
time the call occurs. Thus, this determination is made at
run time with the help of dynamic method dispatch .

Is This Answer Correct ?    31 Yes 4 No

what is dynamic method dispatch ?..

Answer / rajashree

This is a unique feature in the name itself
suggests that it is related with run time.In this classes
has methods with same method name and signature.However
which method will b executed will be decided during run

Is This Answer Correct ?    30 Yes 12 No

what is dynamic method dispatch ?..

Answer / shanti bhushan singh

In dynamic method dispatch a reference of class can be
created and that can be used to executed overridden method
at run time.

Is This Answer Correct ?    20 Yes 5 No

what is dynamic method dispatch ?..

Answer / ramya

Dynamic method dispatch is the process the Java runtime
system uses to determine which method implementation to call
in an inheritance hierarchy. For example, the Object class
has a toString() method that all subclasses inherit, but the
String class overrides this method to return its string
content. If a String or other object type is assigned to an
Object reference using application logic, the Java compiler
cannot know in advance where a call to the toString() method
will be resolved, it must be determined dynamically at runtime.

Is This Answer Correct ?    7 Yes 3 No

what is dynamic method dispatch ?..

Answer / srinivasa

Dispatching call to a method at runtime by jvm.In dinamic
dispatch method invocation jvm identifies which should be

Is This Answer Correct ?    8 Yes 5 No

what is dynamic method dispatch ?..

Answer / j mathew

class A{
void hallo(){
System.out.println(" hallo of A");
class B extends A {
void hallo(){ // method overridden.
System.out.println("hallo of B");
class C extends B {
void hallo(){ // method overridden
System.out.println("hallo of C");
class Demo {
public static void main(String[] args) {
A a = new A(); // create object of A
B b = new B(); // create object of B
C c = new C(); // create object of C
A r; // create a reference of super class
r=a; // assign object of A to the reference var. r
r.hallo(); // it calls hallo() of class A
r=b; // super class variable can reference a
sub class object.
r.hallo(); // it calls hallo() of class B
r =c; // super class variable can ref. sub
class object.
r.hallo(); // it calls hallo() of class C

this is how dynamic dispath method works.
overridden methods are resolved at run time rather than
compile time. At compile time it doesn't know which over-
ridden method will be called.
it comes to know at run time, thats why it is called as run
time polymorphism.

Is This Answer Correct ?    6 Yes 3 No

Post New Answer

More Core Java Interview Questions

Explain restrictions for using anonymous inner classes?

0 Answers  

How do you compare two strings? any predefined method for this?

3 Answers  

What are nested classes in java?

0 Answers  

What are the differences between include directive and include action?

0 Answers  

Explain restrictions on using enum?

0 Answers  

What is an i/o filter?

0 Answers  

Why do we use regex?

0 Answers  

I have a Person object with 5 variables and I want to store them in a file called Person.txt. What should I do?

3 Answers   KPIT,

Differentiate constructor and a method and how are it be used?

7 Answers   Wipro,

How to excute - Interface - Inner class- method can any one tell how to execute/ call this main method public interface abc { static int i=0; void dd(); class a1 { a1() { int j; System.out.println("inside"); }; public static void main(String a1[]) { System.out.println("in interfia"); } } }

1 Answers  

Default layout of Dialog object?

1 Answers  

Can we use string in switch case in java?

0 Answers