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 synonym of framework?
what is thread? : Java thread
What does .equals do in java?
What is singleton class in ruby?
What is the main use of generics in java?
What is a super method?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
If a class is declared without any access modifiers, where can the class be accessed?
What is mean by collections in java?
Explain the advantages of packages in java?
when you will synchronize a piece of your code? : Java thread
What is an interoperable application in java ?
What is the buffer limit?
What is a treeset class?
Explain wait() method of object class ?