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.