Unit 3 Cycle 2 Day 6: Overriding vs Overloading

Unit 3 Advanced (Cycle 2) Day 6 of 28 Advanced

Overriding vs Overloading

Section 3.13 — Overriding Methods

Key Concept

Overriding requires the exact same method signature (name and parameter types), while overloading uses the same name with different parameter types. A method with a different parameter list is an overload, not an override, even if the name matches. The AP exam creates traps where a method appears to override but actually overloads due to a subtle parameter difference (like int vs double or adding an extra parameter). The superclass version still runs for calls that match the original signature.

Consider the following classes.

public class Parent { public String greet() { return "Hello"; } } public class Child extends Parent { public String greet(String name) { return "Hi " + name; } }

Which statement is correct about the Child class?

Answer: (B) greet(String) overloads greet() from Parent.

Child's greet(String) has a different parameter list than Parent's greet(). Different parameters = overloading, not overriding. Child has BOTH methods: greet() inherited from Parent and greet(String) defined in Child.

Why Not the Others?

(A) Overriding requires the exact same method signature (name and parameters). Different parameters = overloading.

(C) The inherited greet() is still accessible. Overloading adds a method, it does not replace one.

(D) Overloading is valid. The code compiles successfully.

Common Mistake

Overriding: same name AND same parameters in subclass. Overloading: same name but DIFFERENT parameters. Overloading adds a new version; overriding replaces the parent version.

AP Exam Tip

Override = same signature, different class (subclass replaces parent). Overload = same name, different parameters (can be in same class). The AP exam tests this distinction directly.

Review this topic: Section 3.13 — Overriding Methods • Unit 3 Study Guide

More Practice

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.