java 单例模式
作者:互联网
package javalearn; public class SingleInstance { private volatile static SingleInstance instance; private SingleInstance(){ } public static SingleInstance getInstance(){ if (instance==null){ synchronized(SingleInstance.class){ if (instance==null){ instance = new SingleInstance(); } } } return instance; } }
标签:java,模式,instance,SingleInstance,static,private,单例,null,class 来源: https://www.cnblogs.com/zheng123/p/11187988.html