MCQ
Single Best Answer
Easy
QWhich of these keywords must be used to inherit a class?
ID: #2241
Inheritance in Java MCQ
7,993 views
Question Info
#2241Q ID
EasyDifficulty
Inheritance in Java MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option D
Explanation
In Java (and many other object-oriented languages), the extends keyword is used to inherit a class. This keyword allows a subclass to inherit properties and methods from a superclass, promoting code reuse and establishing a relationship between the two classes.
Explanation:
- A)
super: This keyword is used to refer to the superclass's methods and constructors, but it does not create inheritance. - B)
this: This keyword is used within a class to refer to the current instance, but it is unrelated to inheritance. - C)
extent: This is not a keyword in Java. - D)
extends: This is the correct answer, as it establishes a parent-child relationship by allowing a subclass to inherit from a superclass.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic