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
How can the checkbox class be used to create a radio button?
Can we override constructors in java?
What is int lol?
Can set contain duplicates?
What is another word for methodology?
How do you know if a value is nan?
What is the use of volatile in java?
What is a parameter used for?
Explain creating threads by implementing runnable class?
What is difference between calling start() and run() method of thread?
What are different data structures in java?
In java, what is the difference between method overloading and method overriding?
What advantage do java's layout managers provide over traditional windowing systems?
What is meant by class and object in java?
What are the differences between wait() and sleep()?