what do you meant by Runtime Polymorphism?
Answer Posted / ramkiran
The function which calls at runtime ratherthan the
compiletime
Ex:
Class A
{
Public void test(){
System.out.println(“This is Base Class”);
}
}
Class B extends A{
Public void test(){
System.out.println(“This is Child Class”);
}
}
Class RuntimePoly{
Public static void main(){
A a = new A();
B b = new B();
A baseClassVar;
baseClassVar = a;
baseClassVar.test();
baseClassVar = b;
baseClassVar.test();
}
}
| Is This Answer Correct ? | 30 Yes | 10 No |
Post New Answer View All Answers
What is package protected in java?
What is null statement?
Can java program run without jre?
What is string in java?
What is java ceil?
Why is singleton class used?
Explain illegalmonitorstateexception and when it will be thrown?
What is diamond operator in java?
What is difference between string and stringbuffer?
What is factor r?
Does java runtime require a license?
What are the two ways in which thread can be created?
Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.
Variables used in a switch statement can be used with which datatypes?
What do you meant by active and passive objects?