Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Description

In this lesson, students will learn about superclasses and subclasses. A superclass is a parent class that contains common attributes and behaviors used by subclasses (children). Subclasses can draw upon the existing attributes and behaviors of the superclass without repeating these in the code. This lesson corresponds with AP Computer Science A topic 9.1.

Objective

Students will be able to:

  • Create an inheritance relationship from a subclass to the superclass
Description

In this lesson, students will write constructors for subclasses. The superclass constructor can be called from the first line of a subclass constructor by using the keyword super and passing appropriate parameters. This lesson corresponds with AP Computer Science A topic 9.2.

Objective

Students will be able to:

  • Write constructors for subclasses
Description

In this lesson, students will learn how to override methods in a superclass/subclass relationship. Method overriding occurs when a public method in a subclass has the same method signature as a public method in the superclass. This lesson corresponds with AP Computer Science A topic 9.3.

Objective

Students will be able to:

  • Override a method in a superclass/subclass relationship
Description

In this lesson, students will use the super keyword. This keyword can be used to call a superclass’s constructors and methods even if the method has been overridden. This lesson corresponds with AP Computer Science A topic 9.4.

Objective

Students will be able to:

  • Use the super keyword to call a superclass’s constructors and methods
Description

In this lesson, students will create references using inheritance hierarchies. An object can take on different forms depending on its implementation. Java can call the correct method even when an object is disguised as a more generic reference type. This is known as polymorphism. This lesson corresponds with AP Computer Science A topic 9.5.

Objective

Students will be able to:

  • Define reference variables of a superclass to be assigned to an object of a subclass in the same hierarchy

Enduring Understandings

This lesson builds toward the following Enduring Understandings (EUs) and Learning Objectives (LOs). Students should understand that…

  • EU Mod-3 When multiple classes contain common attributes and behaviors, programmers create a new class containing the shared attributes and behaviors forming a hierarchy. Modifications made at the highest level of the hierarchy apply to the subclasses. (LO’s 3.B, 3.C)
Description

In this lesson, students will take a deeper dive into Polymorphism. At compile time, methods in or inherited by the declared type determine the correctness of a non-static method call. At run-time, the method in the actual object type is executed for a non-static method call. This lesson corresponds with AP Computer Science A topic 9.6.

Objective

Students will be able to:

  • Call methods in an inheritance relationship
Description

In this lesson, students will call and use the Object superclass. The Object class is the superclass of all other classes in Java. This lesson corresponds with AP Computer Science A topic 9.7.

Objective

Students will be able to:

  • Call Object class methods through inheritance
  • Utilize the Object class through inheritance