Why do we need singleton pattern?



Why do we need singleton pattern?..

Answer / Ashutosh Kumar Srivastava

The Singleton pattern is used when there should be only one instance of a class and that instance should provide services to all other parts of the program. It is useful in scenarios where the resources are expensive, such as database connections or network connections.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Design Patterns Interview Questions

What is aop design?

1 Answers  


How do you ensure quality of code ?

3 Answers   Infosys,


How did you design your unit tests?What about integration tests?

1 Answers  


Give the syntax of css?

1 Answers  


when performing a functional test on a phone calculator,if pressing on a button does not function what do i do next

4 Answers   IBM,


If a client does not like a design what will your approach be?

4 Answers  


What is the use of such a class?

1 Answers  


What is the use of design patterns?

1 Answers  


Dd you useuse OOA/OOD methodologies?did you use design patterns?

1 Answers   HP,


How to add CSS styles Styles to Elements with Particular Attributes?

1 Answers  


Explain what are 5 common problems in the software development process?

1 Answers  


Tell us the kind of features that you add to your design.

3 Answers  


Categories