← Exit to Module 7: Advanced Object-Oriented Concepts lessons
Module progress · 0%Lesson · 20 min
Module 7: Advanced Object-Oriented Concepts
Lesson focusMethod Overriding Rules & Contracts
Revisit overriding with an emphasis on covariant return types, visibility constraints, and exception compatibility.
01 · 25 minDesigning Robust Inheritance HierarchiesLocked02 · 20 minMethod Overriding Rules & ContractsLocked03 · 15 minDeep Dive: The super KeywordLocked04 · 22 minAbstract Classes vs InterfacesLocked05 · 18 minMultiple Inheritance Through InterfacesLocked06 · 14 minDefault & Static Interface MethodsLocked07 · 12 minMarker Interfaces & Metadata AlternativesLocked08 · 20 minAdvanced Polymorphism PatternsLocked09 · 16 minCasting, instanceof, and Pattern MatchingLocked10 · 15 minComposition vs InheritanceLocked11 · 30 minMini-Project: Shape HierarchyLocked
Overriding methods may widen visibility (protected → public) but never restrict it.
Java allows covariant returns—an override can return a subtype of the original return type, improving fluency.
Checked exceptions declared in overrides must be the same or a subtype of the base declaration; unchecked exceptions remain unrestricted.