What is the purpose of singleton design pattern?

Questions by cgrprasad337   answers by cgrprasad337

Showing Answers 1 - 2 of 2 Answers


  • Sep 5th, 2010

Singleton Design Pattern is used when we would like to have a single instance. A class distributes the only instance of itself. It will be used with Connection Pool usually.

  Was this answer useful?  Yes

Singleton design pattern is used to create only one instance.
I want to a an example when we are using this singleton design pattern in real life.

generally the dao classes like insertDao,updateDao,deleteDao for all these cases we make it as a singleton object and put in factory methods .If we require any dao then we
go to factory and get the dao object. because of singleton the facory is going to return same object for multiple times. in real time applications we no need to create same object multiple times.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions