Java Singleton Class


The Singleton class’s default constructor is made private, 
which prevents the direct instantiation of the object by other classes using the new keyword.


The Singleton is a useful Design Pattern for allowing only one instance of your class, but common mistakes can inadvertently allow more than one instance to be created.

Comments

Popular posts from this blog

Edit text with clear button in Android app

Input filter (space not allowed) for EditText

Change Apache Tomcat Port Number