J.III · Java 25 practice question

A developer writes a non-generic interface Marker that extends no other interfaces. According to JLS SE 25, what is a direct supertype of Marker?

Choose one answer
Check answer and explanation

Correct answer: The type Object

Explanation

When a non-generic interface has no direct superinterface types, Object is a direct supertype of that interface type.

Common trap

Picking Cloneable assumes an implicit interface bound that does not exist in the JLS rule. Picking Comparable invents a generic supertype where no superinterface was declared. Picking Comparable invents a generic supertype where no superinterface was declared.

Source: JLS SE 25 §4.10.2. Subtyping among Class and Interface Types
Checked against the cited text on 2026-11-25.

Report an error in this question