KnowledgeBoat Logo

Computer Applications

Why is it must to use 'break' after each case in a switch statement?

Java Conditional Stmts

13 Likes

Answer

Omitting break statement after a case leads to program execution continuing into the next case and onwards till a break statement is encountered or end of switch is reached. To avoid this, we must use break after each case in a switch statement.

Answered By

7 Likes


Related Questions