Java-12: Write a program in Java to demonstrate the use of private constructor and also write a method which will count the number of instances created using default constructor only.
![Java-12: Write a program in Java to demonstrate the use of private constructor and also write a method which will count the number of instances created using default constructor only. Java-12: Write a program in Java to demonstrate the use of private constructor and also write a method which will count the number of instances created using default constructor only.](https://1.bp.blogspot.com/-aQr80EOy67Y/Wv6wXlEwS4I/AAAAAAAAAMM/BMDbhhZZpLAuW3t5EDklZXprs1-0zRKYQCEwYBhgL/s1600/java-lab12.jpg)
Java-12: Write a program in Java to demonstrate the use of private constructor and also write a method which will count the number of instances created using default constructor only.
![Best Use of C# Private Constructors [How To?] - Interview Questions Angular, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, ReactJs Best Use of C# Private Constructors [How To?] - Interview Questions Angular, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, ReactJs](https://2.bp.blogspot.com/-VNy3hboQ4iI/VqiTO_2twJI/AAAAAAAALjY/aQoYqHNqN-o/s1600/You%2Bcannot%2Badd%2Bpublic%2Bconstructor%2Bwithout%2Bparameters.png)