Loading…
Loading…
Ten exam-style questions on if/else chains, braces versus indentation, the dangling else, pattern matching with instanceof, pattern variable rules, supported pattern types and flow scoping, with explanations.
Practice questions for the article Java if/else, Pattern Matching for instanceof and Flow Scoping.
The questions follow Java 21 rules, as on the 1Z0-830 exam. Ignore indentation and trace the braces. For every pattern variable, ask where the match is guaranteed. Aim for at least 8 out of 10 before moving on.
Quiz path: step 13. Take the quizzes in this order, after reading each article.
Previous quiz: Chapter 2 Review: Java Operators (OCP 21)
Next quiz: switch Statements and switch Expressions (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.