Design patterns in Java.
Singleton Pattern according to its definition shall be only used if there is exact one instance of class and also when its accessibility is given from a global access point to the clients.Few real situations are given here where singleton is used: Logger Classes
In design of the logger class the singleton pattern is used. Such classes are basically implemented as singletons so that to provide a global access point for all the components of application. For this purpose
A static member is involved in Singleton class, a static public method and a private constructor while doing implementation. This makes a reference to be returned to the static member.
A getInstance operation is being defined by the Singleton pattern which gives exposure to the unique instance. This unique instance is accessible by the clients. Responsibility of the getInstance() is to create class unique instance if it is not built uptill now and also to return the instance.
Singleton pattern is considered to be a design pattern in software engineering which is used for the implementation of the mathematical singleton’s concepts. It is done by making restrictions at the instantiation of one class to 1 object. It is more beneficial in those cases when just 1 object is required to make the coordination of the actions, across the system. This concept is basically generalized to all those systems which are operating efficiently when 1 object is peresnt, or when instantiation