what is dynamic method dispatch ?
Answer Posted / deepti sharma
Dynamic method dispatch or run time polymorphism is a property by which methods to be called are resolved at runtime.First create super class reference variable in its subclass and an object of both super and sub class and then assign the sub class object to its super class reference variable.
For ex: Class A{
void add();}
Class B extends A{
void add();}
Class C{
p.s.v.m(String args[]){
A a=new A();
B b=new C();
A r;
r=b;
r.add();//call Class B's add method
}}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is difference between next () and nextline () in java?
what do you mean by classloader?
Can a variable be local and static at the same time?
What is meant by data hiding/encapsulation?
What do you mean by JVM?
how to create daemon thread in java?
What is java volatile?
How do you print array in java?
What's the purpose of static methods and static variables?
What is binary search in java?
What is close method? How it's different from Finalize & Dispose?
What are the two types of java programming?
How does split work in java?
Explain the available thread states in a high-level?
What initialize variables?