Singleton pattern using enum type

For any application, we need to be highly conscious about creation and deletion of objects, since it takes huge memory which leads to junks and errors.
Knowing the complexity of maintaining objects, we can opt for using a Singleton design pattern where the class is instantiated only once. Lets look at how to build such a class and all of its constraints.
Now, how to create a singleton class in Java?
Singleton is used when we need to design a component that is unique such as a task manager. There are three ways of implementing a singleton class.
  1. Implementation : Using a private constructor and public static member access.

Comments

Popular posts from this blog

Introduction to SOLR Search Engine

10 Useful Node JS modules

Firebase Essentials