---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 10 Edition"
java_version: 10
chapter: "Chapter 5. Loading, Linking, and Initializing"
section: "5.4.5"
heading: "5.4.5. Overriding"
parent: "5.4. Linking"
source: https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-5.html#jvms-5.4.5
id: "5.4.5"
url: https://jvm.obfuscated.software/jvms/se10/5.4.5.html
raw: https://jvm.obfuscated.software/jvms/se10/5.4.5.md
---

# 5.4.5. Overriding

An instance method `m_C` declared in class C overrides another instance method `m_A` declared in class A iff either `m_C` is the same as `m_A`, or all of the following are true:

- C is a subclass of A.

- `m_C` has the same name and descriptor as `m_A`.

- `m_C` is not marked `ACC_PRIVATE`.

- One of the following is true:

  - `m_A` is marked `ACC_PUBLIC`; or is marked `ACC_PROTECTED`; or is marked neither `ACC_PUBLIC` nor `ACC_PROTECTED` nor `ACC_PRIVATE` and A belongs to the same run-time package as C.
  - `m_C` overrides a method `m'` (`m'` distinct from `m_C` and `m_A`) such that `m'` overrides `m_A`.
