Computer Applications
What is the importance of break and default statements in switch?
Java Conditional Stmts
48 Likes
Answer
- break statement — The break statement takes the flow of control out of the switch statement. Without the break statement, execution would simply continue to the next case.
- default statement — When none of the case values are equal to the expression of switch statement then default case is executed. Default case is optional. If default case is absent and no case values match then none of the statements from switch are executed.
Answered By
28 Likes