📜  java 单例 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:45.204000             🧑  作者: Mango

代码示例2
public final class SomeSingleton {
   public static final SomeSingleton INSTANCE;

   private SomeSingleton() {
      INSTANCE = (SomeSingleton)this;
      System.out.println("init complete");
   }

   static {
      new SomeSingleton();
   }
}