The advantage of a static method is that it can be called directly without generating an instance of the class.
The member that is decorated by the static method no longer belongs to an object, but to the class in which it resides. It needs to be accessed through its class name, without the need to consume resources to create objects repeatedly.
When the class first loads, the static is already in memory, and the memory is not released until the end of the program.
If it is not a static decorated member function, it will be reclaimed by the JVM immediately after it is exhausted.
When do I use static?
If this method is used as a tool, it is declared as static and does not need to be used by a new object. For example: Connect DB can declare a connection () static method,
Because it is static, connection db is not a feature specific to an object, just as a tool to connect to the DB
Why static methods are used