Exams Knowledge Hub

MCQs for Competitive Exams, School & College Exams

Module: | Classes, Objects, OOPs & Inheritance

Q31: Consider the following statements contrasting Abstract Classes and Interfaces:

1. An abstract class is permitted to declare standard instance variables with varying access modifiers, whereas all variables defined in an interface are strictly forced to be public static final constants.
2. Abstract classes can utilize standard constructors to initialize their internal state, whereas interfaces completely lack constructors because they cannot maintain non-static instance state.
3. A Java class can legally inherit from exactly one abstract class and simultaneously implement multiple distinct interfaces in a single structural declaration.

Which of the above statements is/are correct?
A
Only 1 and 2
B
Only 1 and 3
C
Only 2 and 3
D
1, 2, and 3
✅ Correct Answer: D
🎯 Quick Answer:
All three statements (1, 2, and 3) are absolutely correct.
Concept Definition: Abstract classes and Interfaces both provide mechanisms for Abstraction, but they serve fundamentally different architectural roles.
Abstract classes represent an "IS-A" core identity, while interfaces represent a "CAN-DO" capability.
Structural Breakdown: State: Abstract classes hold mutable state (variables). Interfaces only hold immutable constants.
Constructors: Abstract classes have them.
Interfaces do not.
Inheritance: A class 'extends' one abstract class, but 'implements' infinite interfaces.
Historical/Related Context: A classic example taught in academia is the Animal hierarchy.
A 'Dog' IS-A 'Mammal' (Abstract Class, defining core biology like a heart rate variable and constructor), but a Dog CAN-DO 'Swimmable' and 'Runnable' (Interfaces, defining specific behavioral capabilities without requiring a biological state). Causal Reasoning: Interfaces cannot possess constructors (Statement 2) because constructors are specifically designed to allocate and initialize dynamic memory in the Heap for instance variables.
Since interfaces mathematically cannot contain instance variables (only static constants existing in the Metaspace), an interface constructor would have absolutely zero memory to initialize.