J.VII · Java 25 practice question

Which two `switch` constructs were enhanced with pattern matching by JEP 441?

Choose one answer
Check answer and explanation

Correct answer: Both `switch` expressions and `switch` statements.

Explanation

JEP 441 enhanced the Java programming language with pattern matching for both `switch` expressions and `switch` statements.

Common trap

Pattern matching is not limited to `switch` expressions or to `record` classes.

Source: JEP 441: Pattern Matching for switch — Summary
Checked against the cited text on 2026-11-27.

Report an error in this question