Create Mode -- Singlton

1 单例模式

2 代码实现

class Singleton{
    private static Singleton singleton = new Singleton();
    private Singleton(){
    }
    public static Singleton getSingleton(){
        System.out.println("this is single");
        return singleton;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_28197211/article/details/80778734
今日推荐