KnowledgeBoat Logo
|

Computer Applications

What is the purpose of switch statement in a program?

Java Conditional Stmts

126 Likes

Answer

switch statement in a program, is used for multi-way branch. It compares its expression to multiple case values for equality and executes the case whose value is equal to the expression of switch. If none of the cases match, default case is executed. If default case is absent then none of the statements from switch are executed.

Answered By

80 Likes


Related Questions