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

paymentfactory("upi") returns a Upi object. What is the main benefit of this factory?

payment_factory("upi") returns a Upi object. What is the main benefit of this factory?

  1. A.It makes payments faster
  2. B.Calling code does not need to know which concrete class to create
  3. C.It guarantees only one payment object exists
  4. D.It notifies subscribers about payments
Answer & explanation

Correct answer: Calling code does not need to know which concrete class to create

The factory decides the class; callers just use the returned object.

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 →