+ 1
How a private constructor works??
How a private constructor works??
1 Antwort
+ 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