Oracle
1Z0-809 · Question #16
You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design?
The correct answer is B. Make the constructor private. F. Make the single instance created static and final. You've hit your session limit · resets 5:20pm (America/New_York)
Question
You want to create a singleton class by using the Singleton design pattern.
Which two statements enforce the singleton nature of the design?
Options
- AMake the class static.
- BMake the constructor private.
- COverride equals() and hashCode() methods of the java.lang.Object class.
- DUse a static reference to point to the single instance.
- EImplement the Serializable interface.
- FMake the single instance created static and final.
How the community answered
(61 responses)- A3% (2)
- B72% (44)
- C2% (1)
- D8% (5)
- E15% (9)
Explanation
You've hit your session limit · resets 5:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.