In Java, you can use static to declare attributes and methods. This attribute or method is also called a class method after declaring attributes or methods of the static type. It can be called directly by class names.
Static indicates global or static values. It is used to modify member variables or member methods. It can also form static code blocks.
The static modified member variables and member methods are independent of any objects in the class. That is, they are shared by all instances of the class without relying on specific instances of the class.
As long as the class is loaded, the Java Virtual Machine can find them in the Method Area of the runtime data Zone according to the class name. Therefore, a static object can be accessed before any of its objects are created,
You do not need to reference any objects.
What does static and final represent?
Static final is used to modify member variables and member methods. It can be simply understood as a "global constant"
For a variable, it means that once the value is given, it cannot be modified and can be accessed through the class name.
For methods, it means they cannot be overwritten and can be accessed directly by class names.