Skip to content

Rewriting What Your Parent Class Does

☕ Java 17

A child class inherits its parent's methods, but sometimes it needs to do things differently. Here you'll learn how to override a method safely, the four checks the compiler runs, how static methods and fields are hidden instead, and how final locks a method.

In this series

# Page Reading time
1 Overriding a method: the four checks 4 min
2 @Override, hiding and final 4 min
3 Lab: subscription plans that override 4 min

🎓 OCP 1Z0-829 candidates: exam traps and practice questions (optional)

Prerequisites: The Order Java Builds Your Objects In.

Code: Java17_Part_6_Object_Oriented_Basics on GitHub