验证中...
Languages: Java
Categories: Android 组件
Latest update 2019-06-18 21:43
静态内部类实现懒汉单例模式
Raw Copy
/**
* 利用JVM的机制保证线程安全;懒汉加载;不依赖JDK版本;没有性能缺陷;
**/
public class Singleton{
private static SingletonHolder{
private static final Singleton INSTANCE = new Singleton();
}
private Singleton(){
}
public static Singleton getInstance(){
return SingletonHolder.INSTANCE;
}
}

Comment list( 0 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025