设计方式 之 单例模式

设计模式 之 单例模式
对于单例模式, 我就举一个代码例子,

这个代码例子还是有问题的:
public static Singleton getInstance() {
  if(singleton == null) {
     synchronized(Singleton.class) {
       if(singleton == null) {
         singleton = new Singleton();
       }
    }
  }
  return singleton;
}