Consider providing static factory methods instead of constructors

The normal way for a class to allow a client to obtain an instance is to provide a public
constructor.

A class can provide a public static factory method,which is simply a static method that returns an instance of the class.

Providing a static factory method instead of a public constructor has both advantages and disadvantages.

Continue reading