6.3 One for All: Static Methods and Class Variables
Object variables are closely related to their objects. When an object is created, its own set of instance variables together represent the state of the object. If an object method changes the value of a instance variable in an object, this change has no effect on the data of the other objects; each object stores an individual assignment. However, in some situations, states or methods are not directly associated with an individual object, but instead with the class—the “blueprint” of the objects.
Java supports this type of affiliation through static members . Since these members don’t belong to any object (thus unlike object members), you can also call them class members . Static members ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access