Question 8
Back to Exercise
In Java 21, what does case Integer i when i > 100 -> mean?
- A It casts every value to Integer
- B It matches only Integers greater than 100, binding the value to i Correct
- C when is a loop
- D It is invalid syntax
Correct Answer: Option B
A guard adds a boolean condition to a pattern.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!