Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Lesson 5.7 Static Variables and Methods

Description

In this lesson, students will take a deeper look at static variables and methods. Static variables belong to the class, and all objects of a class share a single static variable. This lesson corresponds with AP Computer Science A topic 5.7.


Objective

Students will be able to:

  • Define behaviors of a class through static methods
  • Define the static variables that belong to the class.

Enduring Understandings

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

  • EU Mod-2 Programmers use code to represent a physical object or nonphysical concept, real or imagined, by defining a class based on the attributes and/or behaviors of the object or concept. (LO’s 2.A, 2.B, 2.C, 2.D, 2.E, 2.F, 2.G)

  • 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.A)