Static Field

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

Latest DevOps Terms

Related Reading

Margaret Rouse

Margaret Rouse 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 explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…