What is run time polymorphism?
Answer Posted / guest
In Runtime polymorphism the JVM will decide which version
of the method supposed to used.
for example
class Animal{
public void speak(){
System.out.println("Animal speak method callinfg");
}
}
public class Dog extends Animal{
public void speak(){
System.out.println("Dog speak method calling");
}
public static void main(String args[]){
Animal a = new Dog();
a.speak();// u r calling now Animal class speck metod.
}
}
here JVM will decide to execute Dog version of speck
method . This is called runtime polimorphism
thanks
prasad thota
| Is This Answer Correct ? | 13 Yes | 4 No |
Post New Answer View All Answers
How do you declare an empty string?
Is void a data type in java?
What are the 8 primitive data types in java?
Can we override final method?
List the three steps for creating an object for a class?
What are local variables?
What is sorting algorithm in java?
What is set string?
What is the role of the java.rmi.naming class?
Why destructor is not used in java?
What is object cloning in Java?
How to make a class or a bean serializable?
What data type is a string?
What is difference between add() and addelement() in vector?
Explain about method local inner classes or local inner classes in java?