The static method is the method without this. A non-static method cannot be called inside a static method, which in turn is possible. It is also possible to invoke the static method only through the class itself, without creating any objects. This is actually the primary use of the static method. The idea of Java programming
static variables
Static-modified variables are called statically member variables, also known as class variables, and class variables have the same life cycle as classes and are valid throughout the execution of the application.
The difference between a static variable and a normal variable: a static variable is shared by all objects, only one copy in memory, only when the class is initially loaded, the non-static variable is owned by the object, it is initialized when the object is created, there are multiple replicas, and the replicas owned by each object do not affect each other.
Static methods
1, the static method of modification is called statically, because the static method is not dependent on any object can be accessed, so for static methods There is no this, because it does not attach to any object, since there is no object, it is not to mention this. 2. Static methods cannot access non-static member variables and non-static member methods of a class because non-static member methods/variables must be dependent on specific objects to be called, but static member methods/variables can be accessed in non-static member methods. 3. If you want to invoke a method without creating an object, you can set this method to static. The most common static method is the main method, and as to why the main method must be static, it is because the program does not create any objects when it executes the main method, so it is accessible only through the class name.
"Java Starter series" Static keyword