Interview Question

Are constructors inherited?

Constructors are not inherited; subclass constructors must initialize the superclass.

💡 Concept ✅ Quick Revision ☕ Java

Answer

Constructors are not members and are not inherited. • A subclass declares its own constructors. • A subclass constructor invokes another constructor in the same class or a superclass constructor. • If no constructor is declared, the compiler may provide a default constructor under defined conditions.

Example

Code
class Parent { Parent(int value) {} }
class Child extends Parent { Child() { super(1); } }

Quick Revision

Constructors are not inherited; subclass constructors must initialize the superclass.