QWhich of these keywords is used to inherit a class in Java?
Question Info
Choose the Best Option
Click any option to instantly check if you're correct.
Explanation
In Java, the extends keyword is used to indicate that one class is inheriting the properties and methods of another class. For example, public class SubClass extends SuperClass shows that SubClass inherits from SuperClass. Inheritance allows a class to use methods and fields from another class, promoting code reuse and logical hierarchies in object-oriented programming. This structure facilitates polymorphism and method overriding, which are essential features of Java's object-oriented paradigm. The implements keyword, on the other hand, is used when a class wants to implement an interface. super is used to refer to the immediate superclass, and this refers to the current instance of the class.
Share This Question
Challenge a friend or share with your study group.