Here are 15 Java OOP interview questions (with crisp explanations) that test deep
understanding — not just definitions.
1️⃣ Can we override a static method?
Answer: ❌ No — static methods are hidden, not overridden.
class A {
static void show() { [Link]("A"); }
}
class B extends A {
static void show() { [Link]("B"); }
}
A obj = new B();
[Link](); // Output: A
✔ Method call depends on reference type, not object.
2️⃣ Can we override a private method?
Answer: ❌ No.
Private methods are not visible to subclasses.
If subclass defines same method, it’s a new method, not overriding.
3️⃣ Can constructors be overridden?
Answer: ❌ No.
Constructors are not inherited, so they cannot be overridden.
4️⃣ What happens if a superclass constructor
throws exception?
Subclass must handle or declare it.
class A {
A() throws Exception {}
}
class B extends A {
B() throws Exception { }
}
If not handled → compilation error.
5️⃣ Difference between final, finally, and finalize()?
Keyword Meaning
final Constant / cannot override
finally Block in try-catch
finalize() GC method (deprecated in modern Java)
6️⃣ Can we override a method and make it
more restrictive?
Answer: ❌ No.
Access level cannot be reduced.
class A {
protected void show() {}
}
class B extends A {
private void show() {} // ❌ Compile error
}
But you can increase visibility.
7️⃣ What happens if constructor calls
overridden method?
Tricky and dangerous.
class A {
A() { show(); }
void show() { [Link]("A"); }
}
class B extends A {
int x = 10;
void show() { [Link](x); }
}
new B(); // Output: 0
Why?
• B’s constructor not executed yet
• Instance variables not initialized
8️⃣ Is Java pass-by-reference?
❌ No.
Java is pass-by-value — but object references are passed by value.
9️⃣ Can abstract class have constructor?
✔ Yes.
Constructor runs when subclass object is created.
abstract class A {
A() { [Link]("Constructor A"); }
}
Can interface have method
implementation?
✔ Yes (Java 8+).
• default methods
• static methods
interface A {
default void show() {
[Link]("Hello");
}
}
1️⃣1️⃣ What if two interfaces have same default
method?
Must override explicitly.
interface A { default void show() {} }
interface B { default void show() {} }
class C implements A, B {
public void show() {
[Link]();
}
}
Otherwise → compile error.
1️⃣2️⃣ Can we overload main() method?
✔ Yes.
But JVM calls only:
public static void main(String[] args)
Other versions behave like normal methods.
1️⃣3️⃣ What is covariant return type?
Overridden method can return subclass type.
class A {
A get() { return this; }
}
class B extends A {
B get() { return this; }
}
Valid since Java 5.
1️⃣4️⃣ What is object slicing in Java?
Trick question.
❌ Java does NOT support object slicing (unlike C++).
A obj = new B();
Object remains full B type in memory.
Only reference is A.
1️⃣5️⃣ What happens if we don’t define any
constructor?
Java provides:
✔ Default no-arg constructor
But if you define any constructor → default is removed.
Bonus Tricky Concept Questions
✔ What is tight coupling vs loose coupling?
Inheritance = tighter coupling
Interfaces = loose coupling
✔ What is marker interface?
Interface with no methods (e.g., Serializable).
✔ Why multiple inheritance not allowed in Java?
To avoid Diamond Problem ambiguity.