+ 1

How a private constructor works??

How a private constructor works??

28th Apr 2017, 4:19 PM
tharun
tharun - avatar
1 Answer
+ 7
one of the more common usage of private constructor is for the sake of creating a single instance of a class with a singleton design pattern https://www.google.co.il/amp/www.journaldev.com/1377/java-singleton-design-pattern-best-practices-examples/amp the static method is called from outside the class, the constructor is called ONCE only from within the class
28th Apr 2017, 4:33 PM
Burey
Burey - avatar