@@ -0,0 +1,888 @@
+/**%0A * @File name : Singleton.java%0A * @Description :%0A * @Creator : zhaoliang1%0A * @CreateTime : 2016%E5%B9%B42%E6%9C%8817%E6%97%A5 %E4%B8%8B%E5%8D%884:33:24%0A * @Version : 1.0%0A * @Update records:%0A *         1.1 2016%E5%B9%B42%E6%9C%8817%E6%97%A5 by zhaoliang1:%0A *         1.0 2016%E5%B9%B42%E6%9C%8817%E6%97%A5 by zhaoliang1: Created%0A *         All rights served : SINA Corporation%0A */%0Apackage com.example.pattern.singleton;%0A%0Apublic class Singleton %7B%0A%0A    private Singleton() %7B%7D%0A%0A    private static class SingletonHodler %7B%0A%0A        private static final Singleton instance = new Singleton();%0A    %7D%0A%0A    public static synchronized Singleton getInstance() %7B%0A        return SingletonHodler.instance;%0A    %7D%0A%7D%0A%0Aclass SingletonUnsafe%7B%0A    private SingletonUnsafe()%7B%7D%0A    private static SingletonUnsafe instance;%0A    public static SingletonUnsafe getInstance()%7B%0A        if(instance == null)%7B%0A            instance = new SingletonUnsafe();%0A        %7D%0A        return instance;%0A    %7D%0A    %0A%7D%0A

add safe singleton and unsafe singleton design pattern