Private constructor is used if you do not want other classes to instantiate the object. The instantiation is done by a
public static method within the same class.
1.Used in the singleton pattern..
2.Used in the factory method pattern .
3.Used in utility classes e.g. StringUtils etc.
No comments:
Post a Comment