bg left bg right
      
  |  | 
Welcome to SleepyEgg Tech News and Coupon Deals!
Java singleton design pattern PDF Print E-mail
(0 votes)
Written by Sleepy Egg   
Thursday, 23 June 2005
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.


Comments (0)add comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

security image
Write the displayed characters


busy
 


Valid XHTML 1.0 Transitional