使用private和static配合实现
class Singleton{
private static Singleton instance;
private Singleton(){}
public static Singleton getInstance(){
if(instance == null){
instance = new Singleton();
}
return instance;
posted on 2017-05-24 15:08 zawjdbb 阅读(72) 评论(0) 编辑 收藏 举报