KnowledgeBoat Logo

Computer Applications

What is the importance of break and default statements in switch?

Java Conditional Stmts

ICSE

44 Likes

Answer

  1. 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.
  2. 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

27 Likes


Related Questions