Singleton Design Pattern:
The singleton design pattern allows to have one and only one instance of an object to be created within the whole application. This can be achieved in java by making a Singleton class
Benefits:
Singleton pattern provides
-- access only to the unique instances,
-- permits a variable number of instances,
-- provides more flexibility than class operations.
-- it reduces name space, and
-- allows refinement of operations and representations,
Usage:
-- It is used only at those places where the user requires only one instance
of a class to be operating through out the application.
-- It is mostly used in the multi-threaded environments.
-- They often work as global variables permitting the allocation and
initialization whenever required.
Read more at:
www.roseindia.net/java/beginners/SingletonPattern.shtml
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Singleton class
Post your Comment