读书人

史下最给力的代码(既实现了延迟加载又

发布时间: 2012-10-31 14:37:32 作者: rapoo

史上最给力的代码(既实现了延迟加载又保证了线程安全)

?

顺便说一句,想出此方法的不是人,是神!顶礼膜拜!
public class Test {    private static class SingletonHolder {        private static Singleton instance = new Singleton();    }    private Test() {    }    public static Singleton getInstance() {        return SingletonHolder.instance;    }}

读书人网 >编程

热点推荐