Please enable JavaScript to use CodeHS

Chapter 5

Writing Classes

5.7 Static Variables and Methods

Static Variables and Static Methods

Skating and Coding

Using Static Methods and Variables

Static SuperHero

Static Variables: Circle

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: How Many Players in the Game?

Vocabulary

Term Definition
Static Variables Variables that can be accessed by all objects of a class. They are called using the class name, and can be used in static and non-static methods.
Static Methods Methods that can be used directly by the class name. They cannot access instance variables or non-static methods.