Fiveable
Fiveable

Static

Definition

In programming, "static" refers to a variable or method that belongs to the class itself, rather than an instance of the class. It can be accessed without creating an object of the class.

Analogy

Think of a static TV channel that you can watch without having to turn on your television. Similarly, a static variable or method is always available and doesn't require an instance of the class.

Related terms

Instance Variable: A variable that belongs to each individual object created from a class.

Class Method: A method that belongs to the class itself and can be called without creating an object.

Static Block: A block of code in a class that is executed only once when the class is loaded into memory.

collegeable - rocket pep

Are you a college student?

  • Study guides for the entire semester

  • 200k practice questions

  • Glossary of 50k key terms - memorize important vocab



© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.