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 package is math in java?
Explain the different forms of polymorphism?
Why is it called boolean?
What is the major drawback of internal iteration over external iteration?
Does anyone still use java?
How we can run a jar file through command prompt in java?
How many types of parsers are there?
Can finally block be used without a catch?
How does enum work in java?
Is node a data type in java?
Why java applets are more useful for intranets as compared to internet?
Is void a keyword in java?
How define set in java?
java Technical questions asked by JPMC
How do you declare an empty string?