public class Test {
private volatile Test instance= null;
private Test(){}
public static Test getInstance(){
if(instance == null ) {
synchronized(Test.class) {
if(instance==null) {
instance = new Test();
}
}
}
return instance;
}
}
时间: 2024-10-11 11:45:50