Single Choice Easy

QWhich keyword is used to call a constructor of the immediate parent class in Java?

ID: #23124 Inheritance in Java (IS-A) 118 views
Question Info
#23124Q ID
EasyDifficulty
Inheritance in Java (IS-A)Topic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A this
  • B parent
  • C extends
  • D super
Correct Answer

Explanation

In Java, the super keyword is used to refer to the immediate parent class. When used in a constructor, super() calls the constructor of the parent class. This is essential when the superclass has a parameterized constructor or when you want to ensure that the parent class's initialization logic runs before the subclass's logic. The super keyword can also be used to access methods and variables of the parent class that might be overridden in the subclass.

Share This Question

Challenge a friend or share with your study group.