싱글턴으로 만들거면, 2가지를 지키자

  1. 생성자를 private 으로 만든다.
  2. 생성자를 private 으로 만들기 귀찮으면 enum 을 사용하자.
class SingletonObject {
  private static final SingletonObject instance = new SingletonObject();
  private SingletonObject() {}
  public static SingletonObject getInstance() {
    return instance;
  }
}
enum SingletonObject {
  INSTANCE
}