(1) Static Class cannot be extended whereas singleton pattern class can be extended.
(2) Static Class can still have instances (unwanted instances) whereas singleton pattern class prevents it.
(3) Static Class cannot be initialized with a STATE(parameter), whereas singleton pattern class can.
Note: The difference is in Singleton pattern there is an instance of an object and the object resides in Heap memory area and can be passed in different threads.
But if u make the entire class as static with all static methods there will be no object instance, your entire code will be just loaded in the code section.
Here's how Gemini can help you avoid jetlag.
-
If you’ve got a faraway trip coming up, the Gemini app can help you avoid
jetlag so you can make the most of your visit.Once you’ve given Gemini
permission...
1 day ago
No comments:
Post a Comment