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
What is the purpose of the file class in java programming?
What is the main method java?
Is it safe to install java on my computer?
What is a hashmap used for?
What is the map interface in java programming?
What was java originally called?
Explain different types of wrapper classes in java?
Why java is used everywhere?
Why unicode is important?
What is the platform?
hr interview how many minutes asking question
What is an class?
Why there is no call by reference in java?
Can a constructor be private and how are this() and super() method used with constructor?
How many bits is a string in java?