Java Design Patterns Question:

Download Job Interview Questions and Answers PDF

State the purpose of why a Java singleton should be used?

Java Patterns Interview Question
Java Patterns Interview Question

Answer:

Java singleton is used when a constructor and finalize methods are used only once during the lifetime of the application. If a class is referenced from within then it is garbage collected by the Java which can be retrieved if called again but the problem comes when the constructor or finalize methods are used only once.

Download Java Patterns Interview Questions And Answers PDF

Previous QuestionNext Question
Explain the difference between Canonical and GoF form?Explain about state dependence?