J.III · Java 25 practice question
In the JLS SE 25 grammar for TypeParameter, how can an additional bound be attached after a class or interface type in a TypeBound?
Check answer and explanation
Correct answer: By preceding an InterfaceType with an ampersand
Explanation
An AdditionalBound in a TypeBound consists of an ampersand followed by an InterfaceType.
Common trap
Commas separate distinct type parameters in a parameter list rather than chaining bounds on one parameter. Repeating extends with another class does not match the AdditionalBound grammar rule. Repeating extends with another class does not match the AdditionalBound grammar rule.
Source: JLS SE 25 §4.4. Type Variables
Checked against the cited text on 2026-11-25.