The common methods and member variables here refer to non-static methods and non-static member variables
First, Static is the meaning, is a modifier, can be used to modify variables or methods.
Static member variables have global variables that do not function as static member variables and do not have global variables. Local variables are variables inside the methods of the class
Statically static static member variables are member variables of a class that do not belong to the class and are shared only by the class and by all objects. When you change his value in a class, the value in each object changes.
This means that it is not possible to change his value in the object, only in his class, if he has final (static final) to indicate that it is a constant.
The static variable is statically variable and is loaded when the class is loaded, not the static variable instance object.
The static variable, when it changes its value, is changed by the static variable in the other instance, and the non-static variable is changed only in the object in which it resides, and does not affect other instances.
Example: static int i=1; Here i is a static variable. Specific characteristics are as follows
Static member variables and normal member variables
Usage of static methods
When executing the method in a class, the method does not have any action on the member variable, that is, the operation of the static method is not targeted at the object and is used only for that class. Using this class, you do not need to create an object, but can be implemented directly through the class name. Method Name.
Tool classes-class modifiers, member variable modifiers, method modifiers in PNG Java
Class modifier:
Public (access control), which declares a class as a common class, can be accessed by any object, and the main class of a program must be a public class.
Abstract, declaring a class as an abstract class, without implementing a method, requires a subclass to provide a method implementation.
Final, a class life is final (that is, a non-inheriting class), indicating that he cannot be inherited by another class.
Friendly, the default modifier, only objects in the same package can use such a class.
Member Variable modifiers:
Public (Common access control), which specifies that the variable is public and that he can be accessed by any method of the object.
The private access control specifies that the variable allows access only to methods of its own class, and no other methods in any class (including subclasses) are accessible.
Protected (Protect access Control) specifies that the variable can not be accessed by its own classes and subclasses. This variable can be overridden in a subclass.
Friendly, classes in the same package can be accessed, and classes in other packages cannot be accessed.
Final, final modifier, which specifies that the value of this variable cannot be changed.
Static modifier Specifies that the variable is shared by all objects, that is, all instances can use the variable. Variables belong to this class.
Transient (over modifier) specifies that the variable is a temporary variable that is reserved by the system and temporarily has no special effect.
volatile (volatile modifier) specifies that the variable can be controlled and modified by several threads at the same time.
Method Modifiers :
Public (common control character)
Private (proprietary control) specifies that this method can only be accessed by methods such as its own class, which cannot be accessed by other classes (including subclasses)
Protected (Protected access control) specifies that the method can be accessed by its classes and subclasses.
Final, specifies that the method cannot be overloaded.
Static, which specifies a method that can be activated without instantiation.
Synchronize, a synchronous modifier that, in multiple threads, is used to lock the method to which he belongs before running, to prevent access by other threads, and to unlock after the run is finished.
Native, local modifier. The method body that specifies this method is written outside the program in a different language.
Differences between Java static member variable methods and non-static member variable methods