Bird
0
0

In Java, what is the role of the super keyword when used inside a subclass method?

easy📝 Conceptual Q1 of 15
Java - Inheritance
In Java, what is the role of the super keyword when used inside a subclass method?
AIt creates a new instance of the subclass
BIt refers to the immediate parent class instance to access its members
CIt calls the main method of the program
DIt is used to declare a static method
Step-by-Step Solution
Solution:
  1. Step 1: Understand super usage

    The super keyword is used to refer to the parent class instance from a subclass.
  2. Step 2: Identify its purpose

    It allows access to parent class methods or variables that might be hidden or overridden in the subclass.
  3. Final Answer:

    It refers to the immediate parent class instance to access its members -> Option B
  4. Quick Check:

    Using super accesses parent members [OK]
Quick Trick: super accesses parent class members directly [OK]
Common Mistakes:
  • Thinking super creates new objects
  • Confusing super with this keyword
  • Assuming super calls static methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes