J.III · Java 25 practice question

When a generic class or interface is parameterized with non-wildcard type arguments in JLS SE 25, what must hold for each type argument in the list?

Choose one answer
Check answer and explanation

Correct answer: Each type argument in the given range is a type rather than a wildcard

Explanation

For a parameterization of this form with non-wildcard arguments, each argument in the range is a type rather than a wildcard.

Common trap

Requiring only interfaces ignores that classes are valid type arguments. Allowing only one argument when multiple type parameters exist mismatches the parameter count. Allowing only one argument when multiple type parameters exist mismatches the parameter count.

Source: JLS SE 25 §4.5.2. Members and Constructors of Parameterized Types
Checked against the cited text on 2026-11-25.

Report an error in this question