Why should we use singleton pattern instead of static class?



Why should we use singleton pattern instead of static class?..

Answer / Sujata Gupta

While a static class can achieve similar results, the Singleton pattern provides more control. It allows for lazy initialization (eager or on-demand), enforcement of thread safety, and enables the instance to hold state information.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is a marker interface?

2 Answers  


State the merge-sort principle and its time complexity.

1 Answers   Akamai Technologies,


Are strings immutable in java?

1 Answers  


What is string in java?

1 Answers  


How do you start a new line in java?

1 Answers  


What are the new features in java 8? Explain

1 Answers  


What is primitive array?

1 Answers  


is there a separate stack for each thread in java? : Java thread

1 Answers  


What do you mean by mnemonics?

1 Answers  


Is 'null' a keyword?

8 Answers  


List the different types of classloaders in java.

1 Answers  


What is bubble sorting in java?

1 Answers  


Categories