+1 vote
in Design Patterns by
What is Singleton design pattern in Java ?

1 Answer

0 votes
by
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.

Related questions

+1 vote
asked Oct 17, 2019 in Design Patterns by Robin
0 votes
asked Jan 27, 2020 in JAVA by rahuljain1
...