J.II · Java 25 practice question

Which modifier combination is forbidden on an interface method declaration in Java 25?

Choose one answer
Check answer and explanation

Correct answer: Declaring an interface method as synchronized or final.

Explanation

An interface method may not be declared with the modifiers final, synchronized, or native, so declaring an interface method as synchronized or final is forbidden.

Common trap

Private helper methods with block bodies have been permitted in interfaces since Java 9. Static methods with block bodies have been permitted in interfaces since Java 8.

Source: JLS SE 25 §9.4. Method Declarations
Checked against the cited text on 2026-11-25.

Report an error in this question