field

A variable declared inside a class that stores part of an object's state.

In more detail

Each object usually gets its own copy of a field, while class-level fields are shared. Fields are commonly kept private so other code must go through methods.

Examples

.NET binders and serialisers ignore public fields and use properties instead.
Java: private final String name; a final field is assigned once, in the constructor.
private final String name;

Related terms

Taught in

References

Certification courses