我记得我们老师以前写代码最喜欢这样写,表示很不理解
private static Single instance = null;
public static Single getInstance(){
if(instance == null){
instance = new Single();
}
return instance;
}
我以前总是这样写:然后因为老师写的代码好屌一样,我就向他学习了,但是看视频对他们的评价又不是我想的那样
private Single();
private static final Single instance = new Single();
public static Single getInstance(){
return instance;
}