读 java夜未眼 所知

public class Singleton {
private static Object initLock = new Object();

  private static Singleton instance = null;

  public static synchronized Singleton getInstance() {

  //这个方法比上面有所改进,不用每次都进行生成对象,只是第一次     
  //使用时生成实例,提高了效率!
if(instance != null)
return instance;
  if (instance==null){
synchronized(initLock){
if(instance == null)
     instance=new Singleton();
   return instance;   
}
}
}
}

LZ写的这个也不是多例 模式啊
还是个单例模式 一般叫懒汉式单例模式吧