Question:

What is the purpose of the super keyword in Java?

Show Hint

Remember the pair: `this` refers to the current instance of the class, while `super` refers to the parent (superclass) part of the current instance.
Updated On: Jul 2, 2026
  • To refer to the superclass object
  • To refer to the current object
  • To define a constant
  • To allocate memory dynamically
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

In Java, the `super` keyword is a reference variable that is used to refer to the immediate parent class (superclass) object.
It has two main uses:
1. To call the superclass's constructor: The first statement in a subclass constructor can be a call to a superclass constructor using `super(...)`. If not explicitly called, the compiler automatically inserts a call to the no-argument superclass constructor `super()`. 2. To access members of the superclass: If a subclass has a member (method or variable) with the same name as a member in its superclass, `super` can be used to access the superclass's version. For example, `super.myMethod()` calls the method from the parent class.
Let's analyze the options:
(A) To refer to the superclass object: This is the correct purpose.
(B) To refer to the current object: This is the purpose of the `this` keyword.
(C) To define a constant: This is the purpose of the `final` keyword.
(D) To allocate memory dynamically: This is the purpose of the `new` keyword.
Was this answer helpful?
0
0