Java单例模式的最佳实现(国外牛人写的)

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

 

posted @ 2013-04-28 20:04  Agrimony  阅读(192)  评论(0编辑  收藏  举报