0
点赞
收藏
分享

微信扫一扫

华为平板与非华为电脑多屏协同及Bug处理

言诗把酒 2024-10-08 阅读 32

什么是单例模式?

单例模式的定义:

确保某一个类 只有一个实例,而且自行实例化并向整个系统提供这个实例。


public class Singleton {

	//私有化构造函数
    private Singleton(){}

    private static Singleton instance = null;

    static {
        instance = new Singleton();
    }

    public static Singleton getInstance(){
        return instance;
    }
}


举报

相关推荐

0 条评论