Jhonney的专栏

   ----人见人爱
随笔 - 49, 文章 - 1, 评论 - 23, 引用 - 0
数据加载中……

单例的实现

public class Singleton {     
    
  static class SingletonHolder {     
    static Singleton instance = new Singleton();     
  }     
    
  public static Singleton getInstance() {     
    return SingletonHolder.instance;     
  }     
    
}   

See in : http://crazybob.org/2007/01/lazy-loading-singletons.html
See also : http://www.oreillynet.com/onjava/blog/2007/01/singletons_and_lazy_loading.html

posted on 2007-04-12 21:55 Jhonney 阅读(249) 评论(0)  编辑  收藏 所属分类: 转载区


只有注册用户登录后才能发表评论。


网站导航: