您的位置:首页 > 编程语言 > Java开发

JAVA基础--单例模式

2016-04-25 10:50 501 查看
public class Singleton02 {
// 私有的静态的类变量
private static Singleton02 instance = null;
// 私有的构造方法
private Singleton02() {
}
// 静态的公有的方法
public static Singleton02 getInstance() {
if (instance == null) {
instance = new Singleton02();
}
return instance;
}
}


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: