The correct answer is: A. subclass.
A subclass is a class that inherits from another class, called the superclass. The superclass is also called the parent class. The subclass can add new members, override existing members, and use the members of the superclass.
For example, the following code shows a class called Animal
and a subclass called Dog
:
“`class Animal {
public void eat() {
System.out.println(“Eating”);
}
}
class Dog extends Animal {
public void bark() {
System.out.println(“Woof!”);
}
}
Subscribe on YouTube