There is no concept of global variables in Java.
If static modifies a member variable, all instances of the class share this variable when the object of the class is generated, and the variable can be accessed before the object is created. This variable can be initialized only at the time of definition or in a static block of code .
A static code block is represented by a statically decorated block of code, and when the JVM loads the class, it executes the code block and executes only once. If there are multiple static code blocks, the JVM loads the classes in the order in which they appear in the class.
When a member variable is modified to be final rather than static, it belongs to the instance variable of the class (as opposed to a static variable), and when the class is loaded into memory, the property does not allocate memory space, but only defines a variable that is allocated memory space only when the class is instantiated. The constructor is executed at the same time as the instantiation, so the property is initialized, conforming to the condition that the allocated memory space needs to be initialized and no longer changed.
When a member variable of a class is both modified to static and final, it belongs to a class variable. When a class is loaded into memory, it allocates memory for this variable because it is also final decorated, giving it an initialization value after the variable is defined. The constructor is executed only when the class is instantiated, so you cannot initialize the static and final decorated member variables with constructors (otherwise there will be contradictions), and the member variable can still be initialized in the static block.
The static method can be called directly from the class name, and any instance can also be called (this is consistent with the static member variable). However, you cannot use the This and Super keywords in the static method, you cannot directly access the instance variables and instance methods of the owning class, only the static member variables and static methods of the owning class.
Because the static method is independent of any object, the static method must be implemented, not abstract.
Static is used to modify member variables and member methods, and does not apply to local variables.