Loading…
Loading…
Ten exam-style questions on switch selector types, compile-time constant case values, fall-through and break, arrow labels, switch expression semicolons, yield, result types and exhaustiveness, with explanations.
Practice questions for the article Java switch Statements and switch Expressions: case Values, yield and Exhaustiveness.
The questions follow Java 21 rules, as on the 1Z0-830 exam. In a colon-form switch, follow the fall-through until a break. In a switch expression, count the semicolons. Aim for at least 8 out of 10 before moving on.
Quiz path: step 14. Take the quizzes in this order, after reading each article.
Previous quiz: if/else, Pattern Matching for instanceof and Flow Scoping (OCP 21)
Next quiz: Pattern Matching for switch and Record Patterns (OCP 21)
10 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.