🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Synchronized method
  2. B.Eager static field
  3. C.Holder idiom
  4. 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 →