Home Help Java S Singleton class



Singleton class
Posted on: June 11, 2009 at 12:00 AM
The singleton design pattern allows to have one and only one instance of an object to be created within the whole application.

Singleton class

     

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

Related Tags for Singleton class:
javacclasssingletonthisietosingleecaninasmcaletjclskisvassthavchiono


More Tutorials from this section

Ask Questions?    Discuss: Singleton class  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

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.