🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Design Patterns: all 10 questions

Quiz: Design Patterns · Question 4 of 10

Why is a Singleton's constructor private?

Why is a Singleton's constructor private?

  1. A.To make it faster
  2. B.So other code can't create extra instances with new
  3. C.Because constructors must be private
  4. D.To allow inheritance
Answer & explanation

Correct answer: So other code can't create extra instances with new

Only the class itself can create its single instance.

Can you get the rest right without peeking?

Take the timed Quiz: Design Patterns quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →