It's not because your definition is wrong. The understanding of what
private does is correct.
static does not say that it is visible to other classes. It says that the member belongs to the class and not to an instance of the class. It has nothing to do with visibility, it has to do with the property of the given, with the location where it will be stored and therefore through which component of the language it will be accessed. It is a scope modifier. It defines the lifetime of the member.
As members of the instance can be public or private, members of the class can also.
A static field is one that is available in a class that is unique to the entire application. It is not bound to an instance of the class. It belongs to the class itself and is shared by all instances of this class created during the execution of the application. Life time is any application. While the lifetime of an instance member is the same as the lifetime instance instance to which it belongs.
A static field exists within the class, but its visibility is defined by another modifier.
A private field is one that can only be viewed / accessed within the class. Everything that is private is implementation detail. It means you do not want anyone to know how you are internally (not in the sense of being an industrial secret), giving you the chance to change when you want, any way you want.
What is public is part of the API, is something that you commit to keep stable, after all anyone can access it. You have no control who accessed it and in what form.
Scope and visibility are different things. The place of the existence of the die is the scope. Where there may be a request for access to this data, ie where it can be accessed, it is visibility.
And it's simple to test and verify this since you have two static members each with different visibility. Both are variables belonging to the class and not to an instance.
getConnection() is instance.
Try to access the
instance field from another location outside this class. You can do it any way you want (except for reflection or another trick that goes over the language :)). It does not. Only access within the class.
On the other hand the
getInstance() method is static and public. Try to access from outside. You can.