What are the steps to implement Singleton Design pattern in our java class
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
The most common implementations use the following ingredients:
* Private constructor - prevents any other class from making an instance
* Static getInstance() method - gives clients a way to get the one instance
* Static variable - holds the one instance
Can you picture how those would work together? See if you can code something up and share what you make. It will be a lot more memorable than just copying an answer we give you.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
rex tony
Ranch Hand
Joined: Aug 29, 2007
Posts: 159
posted
0
Thanks james i got some idea from your concepts.Can you tell me what are the pros and cons.
rex tony
Ranch Hand
Joined: Aug 29, 2007
Posts: 159
posted
0
James, Can you tell me all the design pattern procedure like this with pros and cons
rex tony
Ranch Hand
Joined: Aug 29, 2007
Posts: 159
posted
0
James, Can you tell me all the design pattern procedure like this with pros and cons
Kevin Smither
Ranch Hand
Joined: Oct 22, 2007
Posts: 30
posted
0
gosh just google it, i'm sure you'll get 123456789 hits! sorry to be blunt but there is oodles of information out there on this pattern.