class EagerSingleton { private static final EagerSingleton m_instance = new EagerSingleton(); private EagerSingleton() { } public static EagerSingleton getInstance() { return m_instance; } } class LazySingleton { private static LazySingleton m_instance = null; private LazySingleton() { } public static LazySingleton getInstance() { synchronized (LazySingleton.class) { if (m_instance == null) { m_instance = new LazySingleton(); } } return m_instance; } }