Singleton Vs Static Class
"Singleton designing pattern deals with a pattern in which instantiation of object is under control and restrict count by one by making constructor as private "
"A Static mean a class that has only static members"
A Singleton class is supposed to have one and only one instance while a static class is never instantiated.
The singleton pattern has several advantage over the static class pattern
- A Singleton can extend class and implement interfaces, while a static class can not.
- A singleton can be initiated lazily or asynchronously while a static class is generally initialized when it is first loaded
- A singleton class can be extended and its methods overridden , We can not override static methods with non static method
I cannot thank you enough for the blog.Thanks Again. Keep writing.
ReplyDeletejava online training
java training