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
Can a static block throw exception?
Discuss 2D arrays.
How many decimal digits is 64 bit?
How many tetrahedral voids are there in bcc?
How to compare strings in java?
Explain about method local inner classes or local inner classes in java?
Where is jre installed?
What is the importance of hashcode() and equals() methods?
What is meant by data hiding/encapsulation?
Write a program to find the whether a number is an Armstrong number or not?
What do you meant by active and passive objects?
Is stringwriter thread safe?
Is Java a dying language?
What means public static?
Is string is a class in java?