When does Java use static?

Time:2020-9-16

Member variable:

When the shared data appears in the object, the data is modified by static, and the unique data in the object should be defined as non static and exist in the heap memory.

Function:

When there is no access to non static data (object specific data) within the function, the function can be defined as static.