Skip to content
- singleton class can be instantiated only once, static class can’t be instantiated.
- singleton class can inherit an interface, resulting in creating many implementations in runtime if needed, static classes can’t do implement interface.
- singleton class can be injected in constructors, static classes can’t.
- with singletons, we can know exactly when the class is instantiated, with static class we don’t have the control over the object.
- static classes are sticky; they create a coupling when used inside a class.
- static classes can’t be changed, if we need to change some value inside a static class we need to restart the server.