单例模式

2017-06-23  本文已影响0人  RoronoaZoro丶

publicclassSingleton {

privatestaticSingleton instance;

privateSingleton (){}

publicstaticsynchronizedSingleton getInstance() {

if(instance ==null) {

instance =newSingleton();

}

returninstance;

}

上一篇 下一篇

猜你喜欢

热点阅读