in Design Patterns by
What is Singleton design pattern in Java ?

► Click here to show 1 Answer

0 votes
Singleton pattern focus on sharing of expensive object in whole system. Only one instance of a particular class is maintained in whole application which is shared by all modules. Java.lang.Runtime is a classical example of Singleton design pattern. You can also see my post 10 questions on Singleton pattern in Java for more questions and discussion. From Java 5 onwards you can use enum to thread-safe singleton.
Learn More with Madanswer

Related questions

0 votes
asked Oct 17, 2019 in Design Patterns by Robin