![]() |
member > class member > class variable |
![]() ![]() | ||||
class variable (static field, static member variable, static variable) | ||||
subject | fact |
class variable | belongs to 1 class | ![]() |
can be accessed from
| ![]() | |
can be used to store
![]() | ![]() | |
defines an attribute of an entire class | ![]() | |
has definition A data item present in a class that is shared by all instances of that class ![]() | ![]() | |
has a value that is shared by all instances of a class ![]() | ![]() | |
has a name | ![]() | |
is part of a class | ![]() | |
is a subtopic of Members | ![]() | |
is allocated once for a class | ![]() | |
is allocated when the class is loaded | ![]() | |
is declared in the body of the class (not inside a method) ![]() | ![]() | |
is marked as static ![]() | ![]() | |
is not associated with any instance of any class | ![]() | |
is referred to by specifying the name of the class, followed by a dot, followed by the name of the variable | ![]() | |
is a kind of class member | ![]() | |
is a kind of member variable | ![]() | |
represents the state of a class | ![]() | |
should not be overused | ![]() | |
takes the place of global variables used in other languages | ![]() | |
is a synonym of static field | ![]() | |
is a synonym of static member variable | ![]() | |
is a synonym of static variable | ![]() | |
class member | can be used by every method of the class | ![]() |
member variable | can be declared anywhere in a class outside of a method | ![]() |
can be initialized by an assignment statement | ![]() | |
is a member of a class or an object | ![]() | |
is accessible to the code in its class | ![]() | |
variable | can be accessed by other variables and methods in any class in the same package by default ![]() | ![]() |
can contain different classes of objects depending on the type of the variable | ![]() | |
can contain only values that are of the same type as the variable or a subtype of the variable's type | ![]() | |
can refer to a particular object, several different objects during the execution of a program, or no object at all ![]() | ![]() | |
has purpose to refer to an object or a class or a primitive datum | ![]() | |
has scope | ![]() | |
has part value | ![]() | |
is declared by giving the data type followed by the name of the variable ![]() | ![]() | |
is destroyed in the block where it is declared | ![]() | |
may have access modifier | ![]() | |
refers to a class or an object or a primitive datum | ![]() | |
should be as private as possible | ![]() | |
access unit | has access mode | ![]() |
syntactic unit | has syntax rule bold = mandatory | ![]() |
Next class member: class method Up: class member, member variable