Java OOPs Interview Questions and Answers
The Best LIVE Mock Interview - You should go through before Interview
Experienced / Expert level questions & answers
Ques 1. Explain the 'diamond problem' and how Java solves it.
The 'diamond problem' occurs in multiple inheritance when a class inherits from two classes that have a common ancestor. In Java, this is avoided by allowing a class to implement multiple interfaces.
Is it helpful?
Add Comment
View Comments
Ques 2. Explain the concept of method hiding in Java.
Method hiding occurs when a subclass provides a static method with the same signature as a static method in its superclass. It does not override the superclass method.
Example:
class Parent { static void display() { /* method implementation */ } }
class Child extends Parent { static void display() { /* hiding method implementation */ } }
Is it helpful?
Add Comment
View Comments
Most helpful rated by users: