zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy Guide
Question BankQuestion Bank

Creating References Using Inheritance Hierarchies

Caleb Thomas

Caleb Thomas

5 min read

Next Topic - Polymorphism

Listen to this study note

Study Guide Overview

This study guide covers inheritance hierarchies, focusing on the relationships between superclasses and subclasses. It explains type diagrams (or hierarchy trees) as visual representations of these relationships. The guide also introduces polymorphism, demonstrating how subclass objects can have multiple types and its implications for method parameters, arrays, and ArrayLists.

#Inheritance Hierarchies

Now that we are done with making our subclass, let's look at inheritance from a user standpoint.

Inheritance can be thought as an upside down tree with the "root" on the top and the "branches" on the bottom. The root is the superclass while the branches are the subclasses of this superclass. A visual representation of this tree is called a type diagram or hierarchy tree.

Here is the hierarchy tree that we will look at for the next two topics:

![](https://zupay.blob.core.windows.net/resources/files/0baca4f69800419293b4c75aa2870acd_19a4fb_1538.png?alt=media&token=ae860a2d-47f4-4...

Feedback stars icon

How are we doing?

Give us your feedback and let us know how we can improve

Previous Topic - Super KeywordNext Topic - Polymorphism

Question 1 of 8

In an inheritance hierarchy, which class is considered the 'root' of the tree? 🤔

The subclass

The superclass

Any class in the hierarchy

The class with no subclasses