Class/Static Variables
-
Are declared with the static keyword in a class, but outside a method, constructor or a block.
-
There would only be one copy of each class variable per class, regardless of how many objects are created from it.
-
Are stored in the static memory. It is rare to use static variables other than declared final and used as either public or private constants.
-
Are rarely used other than being declared as constants.
-
Are created when the program starts and destroyed when the program stops.
-
Visibility is similar to instance variables. However, most static variables are declared public since they must be available for users of the class.
-
Can be accessed by calling with the class name ClassName.VariableName.
Class/Static Variables —
Structure map
Clickable & Draggable!
Class/Static Variables —
Related pages: