objects cannot be created directly if the constructor is private. A static method has be implemented that in turn calls the constructor.
This
pattern is typically used when the application need to control the number of objects that can be created. The best example is a singleton class where it is desired that the class have only a SINGLE instance in the life of the application.
Ex:
This example is ofcourse not
thread safe.