85 OOPs Interview Questions in Java (2026)

80. What is the difference between method overloading and method overriding in Java?

Ans: Refer to this tutorial: Top 10 Difference between Overloading and Overriding in Java

81. What is Method hiding in Java?

Ans: If a static method defined in the parent class is redefined in a child class, the child class’s method hides the method defined in the parent class. This mechanism is called method hiding in Java or function hiding.

82. What is the output of the following code?

public class X { 
 protected static void m1(int a) { 
      System.out.println("m1-X"); 
  } 
 } 
public class Y extends X 
{ 
 static void m1(int y) { 
      System.out.println("m1-Y"); 
  } 
} 
public class MyTest { 
 public static void main(String[] args) { 
    X x = new Y(); 
    x.m1(10); 
   
 Y y = new Y(); 
   y.m1(20); 
  } 
}

Ans: Output: m1-X, Compile-time error because we cannot reduce the visibility of the inherited method from X.

83. What is the difference between method hiding and method overriding?

Ans: The difference between method hiding and method overriding is as follows:

a. In method hiding, both parent and child class methods should be static whereas, in overriding, both parent and child class methods should be non-static.

b. Compiler is responsible for method resolution based on reference type whereas, in method overriding, JVM is always responsible for method resolution based on runtime object.

c. Method hiding is also known as compile-time polymorphism whereas, method overriding is also known as runtime polymorphism.

84. What is dynamic method dispatch in Java?

Ans: Dynamic method dispatch is a technique in which object refers to superclass but at runtime, the object is constructed for subclass.

85. Why is dynamic method dispatch important in Java?

Ans: Dynamic dispatch method is important because it is a process through which Java implements runtime polymorphism.

For practice coding based on dynamic method dispatch, go to this tutorial: Dynamic method dispatch in Java.


For more programming Interview Questions on OOPs concepts, follow the below links:


Hope that these OOPs interview questions in Java will help you to understand the level of questions asked by the interviewer. These are general OOPs interview questions that should be prepared by those who want to crack technical tests and interviews. New Questions will be regularly updated. Please, share it on social networking sites for your friends.
All the best!!!

DEEPAK GUPTA

DEEPAK GUPTA

Deepak Gupta is the Founder of Scientech Easy, a Full Stack Developer, and a passionate coding educator with 8+ years of professional experience in Java, Python, web development, and core computer science subjects. With strong expertise in full-stack development, he provides hands-on training in programming languages and in-demand technologies at the Scientech Easy Institute, Dhanbad.

He regularly publishes in-depth tutorials, practical coding examples, and high-quality learning resources for both beginners and working professionals. Every article is carefully researched, technically reviewed, and regularly updated to ensure accuracy, clarity, and real-world relevance, helping learners build job-ready skills with confidence.