When does Java use static?


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.


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