← Quiz: Creational Patterns in Java: all 10 questions
Quiz: Creational Patterns in Java · Question 5 of 10
Which Singleton version is also protected against reflection and serialization creating a second instance?
Which Singleton version is also protected against reflection and serialization creating a second instance?
- A.Synchronized method
- B.Eager static field
- C.Holder idiom
- D.enum with one constant
Answer & explanation
Correct answer: enum with one constant
The JVM guarantees enum constants are created exactly once.
Can you get the rest right without peeking?
Take the timed Quiz: Creational Patterns in Java quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →