Posted By

mifly on 05/31/09


Tagged

Singleton


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adkatrit


Singleton


 / Published in: Java
 

URL: http://www.oreillynet.com/onjava/blog/2007/01/singletons_and_lazy_loading.html

  1. public class Singleton {
  2.  
  3. static class SingletonHolder {
  4. static Singleton instance = new Singleton();
  5. }
  6.  
  7. public static Singleton getInstance() {
  8. return SingletonHolder.instance;
  9. }
  10.  
  11. }

Report this snippet  

You need to login to post a comment.