java – private static и private final static – зачем?


When should you mark variables this way? What's the use of static if it's marked private ?


Take a look at the data on the design .

private static guarantees the uniqueness of an instance of an object with such properties on the thread where the class is involved.

private static final ensures that this instance is not swapped for something else.

Convenient when working with databases or some resource that is not prone to splitting.

Scroll to Top