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
Explain listiterator and methods in listiterator?
Why is logger singleton?
How can you make a class serializable in java?
Why do we use return statement?
How can we make sure main() is the last thread to finish in java program?
Compare overloading and overriding?
What is fundamental datatype?
What do you mean by ternary operator in java?
What is sizeof in java?
What are use cases?
What are three types of loops in java?
What is core java called?
Which is a valid identifier?
what is heap memory?
Why is java called java?