what is dynamic method dispatch ?
Answer Posted / md arifulla
dynamic dispatch is nothing but run time polymorphism ,
for example if we take a reference variable of super class
and the abject of sub class is assigned to the reference of
super class
ex:
class A
{
print()
{
System.out.println("class A");
}
}
class B extends A
{
print()
{
System.out.println("class B");
}
}
class C{
public static void main(String srgs[])
{
A a=new A();
B b;
b=a;
a.print();//invokes the print of class A
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Does variable declaration allocate memory?
Difference between arraylist and hashset in java?
Why multiple inheritance is not supported by java?
Explain the pointers in Java?
Is integer a class?
Is logger a singleton?
Can we call the constructor of a class more than once for an object?
In java, how we can disallow serialization of variables?
What do you meant by active and passive objects?
Can each java object keep track of all the threads that want to exclusively access it?
What is main method?
Who developed java?
What is the purpose of finalization in java programming?
What is pangram in java?
what is a green thread? : Java thread