Superclasses and Subclasses

Learn about superclasses and subclasses in Java.

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.

Get hands-on with 1200+ tech skills courses.