Why do we need singleton?



Why do we need singleton?..

Answer / Harish Chandra Pandey

A Singleton pattern is used in Java to ensure that only one instance of a class exists at any given time. This is useful when there's a need to have a global point of access to an object, or when the cost of object creation is high.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Difference between java and javascript

1 Answers  


State some situations where exceptions may arise in java?

1 Answers  


What is classname class in java?

1 Answers  


How do I compare two strings in word in java?

1 Answers  


Is oracle java 11 free?

1 Answers  


what is the difference between a java object reference and c++ pointer?

4 Answers  


Can we define constructor in inner class?

1 Answers  


List implementations of list interface?

1 Answers  


What is concurrent hashmap and its features?

1 Answers  


What do you mean by stack?

1 Answers   Accenture,


When to use runnable interface vs thread class in java?

1 Answers  


What is the difference between inheritance and encapsulation?

1 Answers  


Categories