Java 靜態(tài)內(nèi)部類單列模式
提問(wèn)人:劉旭39發(fā)布時(shí)間:2020-11-26
//靜態(tài)內(nèi)部類單列模式
public class Singleton{
private static class SingletonHolder {
private static final Singleton SINGLETON = new Singleton();
}
private Singleton() {}
public static Singleton getInstance() {
return SingletonHolder.SINGLETON;
}
}
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>