here are three uses of private constructors:
- to prevent instantiation outside of the object, in the following cases:
- factory method
- static-methods-only (utility) class
- constants-only class
- to prevent sublcassing (extending). If you make only a private constructor, no class can extend your class, because it can’t call the
super()constructor. This is some kind of a synonym for
- overloaded constructors – as a result of overloading methods and constructors, some may be private and some public. Especially in case when there is a non-public class that you use in your constructors, you may create a public constructor that creates an instance of that class and then passes it to a private constructor.