Java SE 8 Programmer I — Question 91
Which is true about the switch statement?
Answer options
- A. Its expression can evaluate to a collection of values.
- B. The break statement, at the end of each case block, is optional.
- C. Its case label literals can be changed at runtime.
- D. It must contain the default section.
Correct answer: B
Explanation
The correct statement is B because the break statement is indeed optional in a switch statement; if omitted, execution will continue to the next case. Options A, C, and D are incorrect as a switch statement's expression evaluates to a single value, case labels cannot be modified during execution, and while a default case can be included, it is not mandatory.