This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Singleton Examples

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone share some good examples for using the Singleton design pattern?
I plan on coding a general purpose class with the Singleton pattern. The general purpose class would contain primarily conversion methods(Ex. SQL Date to Util Date). I could code this class with all static methods but one advantage of using the Singleton pattern is the ability to allow subclassing. Does this seem like an appropriate use of the Singleton pattern?
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
please check out this site for all u r queries
http://members.tripod.com/rwald/java/articles/Singleton_in_Java.html
regds.
Rahul.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that the public (accessor )method getInstance () needs to be synchronized in a Singleton.
 
    Bookmark Topic Watch Topic
  • New Topic