/** * Created by hero on 16-4-6. */ public class Singleton { public static Singleton getInstance() { return SingletonHolder.singleton; } private static class SingletonHolder { private static Singleton singleton = new Singleton(); } private Singleton() { } }
原文:http://www.cnblogs.com/littlehoom/p/5361435.html