Exams Knowledge Hub

MCQs for Competitive Exams, School & College Exams

Module: | Core Architecture, Basics & Control Flow

Q19: Consider the following statements regarding the super keyword in Java:

1. The super keyword is a reference variable used to directly invoke immediate parent class methods or access hidden parent class variables.
2. A programmer can successfully utilize the super keyword inside a static method to explicitly reference the parent class's static variables.
3. The super keyword can be utilized an unlimited number of times within a single instance method to continuously refer to parent class members.

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: B
🎯 Quick Answer:
The correct combination is 1 and 3. Statement 2 is incorrect because the super keyword strictly requires an active object instance to function; therefore, it cannot be utilized within a static method which operates independently of instances.
Concept Definition: The super keyword is a built-in reference variable utilized within a subclass to explicitly refer to its immediate parent class object.
Structural Breakdown: The super keyword serves three primary roles: invoking parent class methods, accessing hidden parent class instance variables, and invoking parent class constructors.
Historical/Related Context: Variable shadowing occurs when a subclass declares a variable with the exact same name as a parent class variable.
The super keyword was implemented as the definitive syntactic mechanism to pierce through this shadowing and target the parent's memory allocation directly.
Causal Reasoning: Allowing super inside a static method is logically impossible because static methods reside in the Metaspace and belong to the class blueprint itself.
The super keyword specifically acts as a pointer traversing the Heap memory hierarchy of an instantiated object.