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 predefined function in java?
Print Vertical traversal of a Binary Tree.
What is preparedstatement in java?
What is the public method modifier?
What is comparable and comparator interface? List their differences
Is zero a positive integer?
explain local datetime api in java8?
What is java beans?
What is boolean example?
Why stringbuilder is not thread safe in java?
Why do we need data structure in java?
List some features of the abstract class.
How long will it take to learn java?
What carriage return means?
How do you add spaces in java?