1. static
static is a very important keyword in java, and its usage is also very rich, there are four main usages:
- It is used to modify the member variable and turn it into a member of the class, so as to realize the sharing of this member by all objects;
- It is used to modify a member method and turn it into a class method, which can be called directly using the method of "class name.method name" , which is often used in tool classes;
- Static block usage, initializing multiple class members together makes the program more regular, and it is very important to understand the initialization process of objects;
- Static import package usage, import the method of the class directly into the current class, so that the class method can be called directly using the "method name" , which is more convenient