adspace
Why should we use singleton pattern instead of static class?
Answer Posted / 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 View All Answers
Differentiate between static and non-static methods in java.
What is the difference between break and continue statements?
explain different ways of using thread? : Java thread
How to sort array in descending order in java?
Write a program to print count of empty strings in java 8?
Is minecraft 1.15 out?
How to create a base64 decoder in java8?
Write a program to find the whether a number is an Armstrong number or not?
What is an object in java and how is it created?
What do you mean by an interface in java?
What is java string pool?
Realized?
What is a classloader in java?
What is parsing in java?
What are the differences between heap and stack memory in java?