J.II · Java 25 practice question

Interface I has two direct superinterfaces J and J'. Method m is a member of J, and method m' is a member of J' such that m' overrides m. Does interface I inherit m from J?

Choose one answer
Check answer and explanation

Correct answer: No, because another direct superinterface J' has a method m' that overrides m.

Explanation

Interface I does not inherit m from J because there exists a method m' in another direct superinterface J' that overrides the declaration of m.

Common trap

Overriding between sibling direct superinterfaces filters out the overridden method m so I only inherits the more specific m'. Because m is not inherited when m' overrides it, no conflict error occurs from inheriting both.

Source: JLS SE 25 §9.4.1. Inheritance and Overriding
Checked against the cited text on 2026-11-25.

Report an error in this question