How do you achieve singleton?



How do you achieve singleton?..

Answer / Deepak Ekka

In Java, Singleton can be achieved by declaring a private constructor, providing a static method to create the instance, and storing the single instance in a static field.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Accenture NJ mostly ask question on Collection like 1)How to sort Objcts and how treeset sort them 2)Explain mechanism of Hashcode finding in Java 3)Name some of the Sorted collection.

2 Answers   Accenture,


What is navigable map in java?

1 Answers  


What does java se mean?

1 Answers  


Can I use % with real numbers?

1 Answers  


What is dynamic binding?

2 Answers  


Is jdk required on each machine to run a java program?

1 Answers  


What is a constructor, constructor overloading in java?

1 Answers  


What is the effect of keeping a constructor private?

1 Answers  


What is void class in java?

1 Answers  


In treeset we add same object ...what will be the out put

3 Answers  


Can static method access instance variables ?

1 Answers  


What is the main purpose of serialization in java?

1 Answers  


Categories