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

Quiz: Java Interview Questions · Question 3 of 10

Which is used to implement the Singleton pattern?

Which is used to implement the Singleton pattern?

  1. A.A public constructor
  2. B.A private constructor with a static instance
  3. C.An abstract class
  4. D.A final method
Answer & explanation

Correct answer: A private constructor with a static instance

A private constructor prevents outside creation; a static method returns the single instance.

Can you get the rest right without peeking?

Take the timed Quiz: Java Interview Questions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →