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 an array length?
What is a variable and constant?
Why is java logo a cup of coffee?
Explain the difference between string, stringbuffer and stringbuilder in java?
What is the applet security manager, and what does it provide?
What is the difference between numeric and integer?
What is the difference between reader/writer and inputstream/output stream?
What does void * mean?
What is string literal in java?
Does chrome use java?
What is a cup of java?
What is difference between null and void?
What are the advantages of encapsulation in java?
What is meant by memory leak?
What is void in java?