Java case keyword
The Java case keyword is a conditional label which is used with the switch statement. It contains a block of code which is executed only when the switch value matches with the case.
A switch statement can contain multiple case labels. Each case label must hold a different value. The case label can contain the break statement that terminates the flow of the execution.
Note - The case does not hold the value of boolean, float and double type.
Examples of Java case keyword
Example 1: case label holding the string valueTest it Now
Example 2: Multiple case labelsTest it Now
Example 3: case label holding an int valueTest it Now
Example 4: case label holding switch statementTest it Now
BIT Computer Department