polymorphism
polymorphism
Most Frequently asked Interview Questions and Answer in Java:
In this Java Interview Question blog, we have covered almost total 100+ important polymorphism in OOPs concepts interview questions and answer in java for freshers and experienced candidates one by one topics.
This post on JAVA Interview Questions and Answers is prepared to help you understand the basic concepts of Java programming for top composes interview purposes. All the most important JAVA concepts are explained here with examples for your easy understanding.
This blog covers core JAVA topics, advance java topics and also industry level project related most important Interview Questions with examples to make you get ready perfectly to face any JAVA interview confidently.
Most Popular Java Interview Questions:
Given below is a comprehensive list of most important and commonly asked about Polymorphism in OOPs Concept basic and advanced Java programming interview questions with detailed answers.
1. What is Runtime Polymorphism?
Runtime Polymorphism or Dynamic Polymorphism is the polymorphism that exists at runtime. In case of method overriding it is not known which method will be called at runtime. Based on the type of object, JVM decides the exact method that should be called. So at compile time it is not known which method will be called at run time.
2. Is it possible to achieve Runtime Polymorphism by data members in Java?
No. We need to create Runtime Polymorphism by implementing methods at two levels of inheritance in Java.
3. Explain the difference between static and dynamic binding?
In Static binding references are resolved at compile time. In Dynamic binding references are resolved at Run time.
E.g.
Person p = new Person();
p.walk(); // Java compiler resolves this binding at compile time.
public void walk(Object o)
{
((Person) o).walk(); // this is dynamic binding
}
Comments