0

Private constructor

What is useful from a private constructor? Besides making the class can't be instantiated? In case of java?

28th Feb 2017, 11:40 PM
Marcellino Chris O'vara
Marcellino Chris O'vara - avatar
1 ответ
+ 1
Private constructors are often used along with a Static method that will create or return an instance of itself within that method. Usually used with the singleton design pattern. https://www.tutorialspoint.com/java/java_using_singleton.htm
1st Mar 2017, 4:35 AM
ChaoticDawg
ChaoticDawg - avatar