史上最给力的代码(既实现了延迟加载又保证了线程安全)
?
顺便说一句,想出此方法的不是人,是神!顶礼膜拜!
public class Test { private static class SingletonHolder { private static Singleton instance = new Singleton(); } private Test() { } public static Singleton getInstance() { return SingletonHolder.instance; }}