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
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
Can we assign integer value to char in java?
What is a null class?
When is the garbage collection used in Java?
What is meant by collection in java?
Can we create a constructor in abstract class?
How does compareto work in java?
Can you inherit a constructor java?
What is ternary operator? Give an example.
What is local declaration?
What does string [] args mean?
What is static keyword in java?
What is the meaning of course?
Can we clone singleton object in java?
Is empty set an element of empty set?