Skip to main content
Intermediateconceptual

Explain the Interface Segregation Principle with an example of violating it and fixing it.

ReportedSource: GeeksforGeeks interview experience: Infosys Specialist Programmer L2 off-campus

Quick answerFree

Don't force classes to implement methods they don't use: split a fat interface (Machine with print/scan/fax) into focused ones (Printer, Scanner, Fax) and implement only what applies.

Detailed answer· 76 words

Interview Prep

Unlock the full answer with Interview Prep

Get a 76-word model answer, plus 11 more Java questions.

Also in Pro (₹499 / 90 days).

+ 11 more Java questions in Interview Prep, each with the full answer.

Discussion