Static Field

Why Trust Techopedia

What Does Static Field Mean?

A static field is in programming languages is the declaration for a variable that will be held in common by all instances of a class. The static modifier determines the class variable as one that will be applied universally to all instances of a particular class. A final modifier can also be added to indicate that the class variable will not change.

Advertisements

A static field may also be called a class variable.

Techopedia Explains Static Field

A static field or class variable is often contrasted with a non-static field, which can also be called an instance variable. This kind of more specialized variable applies to only one instance of a given class. For example, if an instance of the class “dog” received an instance variable “red,” it would indicate that a particular dog is red, whereas a similarly applied class variable or static field would indicate that all dogs are red.

A static field or class variable is useful in certain programming languages and code situations to assign a particular variable (representing a common characteristic) to all instances of a class, either as a fixed value, or one that could change in the future. The key to this type of identifier is that if the change happens, it will be applied equally to all instances of the class.

Advertisements

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.