单例模式5种实现方法
单例模式5种实现方法
俄汉式(不能懒加载)/** * 优点:线程安全,调用效率较高 * 缺点:不能懒加载 */public class Sinleton { //1.私有化构造器 private Sinleton() { } //2.立即加载对象 private static Sinleton instance = new Sinleton(); //3.提供访问接口 public static Sinleton getInstance(){


