SleepyEgg

Tech News, Deals, & Games

  • Increase font size
  • Default font size
  • Decrease font size
Home News Tech News Java singleton design pattern

Java singleton design pattern

E-mail Print PDF
singleton is a design pattern that focus on object creation. When a class is implemented using singleton, one and only one such instance can be created in a JVM. Usual implementation will be: 1. making constructor private 2. use a public static "getInstance" method to get an instance object 3. use either lazy instantiation or instantiate it statically 4. if lazy instatiation is used, must synchronized "getInstance" method. 5. the singleton object is private static instace field In some cases you may prefer a abstract class with all static methods. Share Link:
Bookmark Google Yahoo MyWeb Del.icio.us Digg Facebook Myspace Reddit Ma.gnolia Technorati Stumble Upon
Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
 

Polls

Which has the best Graphic?
 

Login

               No account yet?