0

How to create object of private constructor(s) of the class in Java.

If class having private constructor(s) then how to access it to create an object on other class.

21st Jul 2018, 6:59 AM
Sandeep Kushwaha
Sandeep Kushwaha - avatar
3 Answers
+ 6
Private constructors are more commonly used when designing Singleton classes. https://www.geeksforgeeks.org/singleton-class-java/
21st Jul 2018, 7:42 AM
Hatsy Rei
Hatsy Rei - avatar
0
Sandeep Kushwaha Constructors aren't meant to be private in the first place
21st Jul 2018, 7:01 AM
Dlite
Dlite - avatar
21st Jul 2018, 7:05 AM
Sandeep Kushwaha
Sandeep Kushwaha - avatar