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

Quiz: SOLID in Java · Question 6 of 10

An interface has print(), scan() and fax(). A basic printer must implement all three. What is the best fix?

An interface has print(), scan() and fax(). A basic printer must implement all three. What is the best fix?

  1. A.Make scan() and fax() return null
  2. B.Use an abstract class instead of an interface
  3. C.Split it into Printer, Scanner and Fax interfaces
  4. D.Put all three methods in the basic printer and throw exceptions
Answer & explanation

Correct answer: Split it into Printer, Scanner and Fax interfaces

Interface segregation: classes implement only the small interfaces they can really support.

Can you get the rest right without peeking?

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

Start the quiz →