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 if I write static public void instead of public static void in java?
What are the disadvantages of using inner classes?
What is data type modifier?
What is a line separator in java?
What is a java applet? What is an interface?
Explain the public class modifier?
What is method overriding in java ?
What is the use of arrays tostring () in java?
Which class is used by server applications to obtain a port and listen for client requests?
What is unmodifiable collection in java?
What is the difference between method overriding and overloading?
Can you run java program without main method?
What does || mean in code?
What is java jit compilers?
Is null a string or object in java?