JVM Knowledge

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.