Can you make Private Constructor in Java?

Declaring a private constructor is a very rare usage. First of all can we do it? Yes, a constructor can be private and a private constructor can be overloaded also. Following program illustrates. public class Test { private Test() { System.out.println(“I am default private constructor”); } private Test(int x) { System.out.println(“I am overloaded private constructor. …

Can you make Private Constructor in Java? Read More »