← 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?
- A.Liskov Substitution
- B.Single Responsibility
- C.Open/Closed
- 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 →