Java SE 8 Programmer II — Question 132

Which two are elements of a singleton class? (Choose two.)

Answer options

Correct answer: C, D

Explanation

The correct answers are C and D. A singleton class must have a private constructor to prevent external instantiation (D), and it typically includes a public static method to return the single instance (C). Options A, B, and E are incorrect as they do not align with the singleton design pattern's requirements.