Question 20
Back to Exercise
Why must case Integer i when i > 0 come before case Integer i?
- A Alphabetical order
- B The unguarded case would match every Integer first, so a later more specific case would be unreachable (a compile error) Correct
- C Guards run last
- D It does not matter
Correct Answer: Option B
javac reports "this case label is dominated by a preceding case label".
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!