🎙 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 1 of 10

Why is a Singleton's constructor made private?

Why is a Singleton's constructor made private?

  1. A.To make object creation faster
  2. B.So that code outside the class cannot create more instances with new
  3. C.Because static methods cannot call public constructors
  4. D.To allow inheritance from the class
Answer & explanation

Correct answer: So that code outside the class cannot create more instances with new

Only the class itself can create the one instance.

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 →