DEVFYI - Developer Resource - FYI

Where and how can you use a private constuctor.

Java Interview Questions and Answers (part 1)


(Continued from previous question...)

129. Where and how can you use a private constuctor.

Private constructor can be used if you do not want any other class to instanstiate it by using new. The instantiation is done from a static public method, which is used when dealing with the factory method pattern.

(Continued on next question...)

Other Interview Questions