Categories
Core JAVA

What is private constructor ,Factory method and Singleton class in JAVA ?

Factory Method:- If the return type of method is class name then it is known as the Factory method. Private constructor defining a “virtual” constructor. Private Constructor:- The factory┬áconstructor declared with private-keyword is known as private-constructor. If the constructor is private we cannot create an object outside class. The private constructor is used to serve […]