Superclasses and Subclasses

Learn about superclasses and subclasses in Java.

We'll cover the following...

Inheritance in Java

In Java, every class can inherit attributes (instance variables) and behaviors (methods) from another class.

  • Superclass: The parent class, or superclass, is the class being inherited from.
  • Subclass: The child class, or subclass, is the class that is inheriting.

Consider the example below.

Here, both Cat and Dog are child classes, or subclasses, whereas Animal is the ...