Which two properly implement a Singleton pattern?
A.
class Singleton { private static Singleton instance; private Singleton () {} public static
synchronized Singleton getInstance() { if (instance == null) { instance = new Singleton (); }
return instance; } }
B.
class Singleton { private static Singleton instance = new Singleton(); protected Singleton
() {} public static Singleton getInstance () { return instance; } }
C.
class Singleton { Singleton () {} private static class SingletonHolder { private static final
Singleton INSTANCE = new Singleton (); } public static Singleton getInstance () { return
SingletonHolder.INSTANCE; } }
D.
enum Singleton { INSTANCE; }
A