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

A subclass overrides a method and throws UnsupportedOperationException. Which principle is most likely broken?

A subclass overrides a method and throws UnsupportedOperationException. Which principle is most likely broken?

  1. A.Liskov Substitution
  2. B.Single Responsibility
  3. C.Open/Closed
  4. D.None — this is normal practice
Answer & explanation

Correct answer: Liskov Substitution

Code written for the parent type crashes when given this subclass, so it cannot be substituted safely.

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 →