Switch Statement: The switch statement is just like if-else-if ladder statement. It executes one statement from multiple conditions. It works with a byte, short, int, long, and String.
In other words, we can say the Switch case statement is a substitute for a long if statement that compares to several integral values.
Syntax of Switch statement in java
Enhance
Switch or Switch With Arrow:
The new syntax uses the -> operator instead
of the colon we're used to with switch statements. Also, there's no break
keyword.
Another addition is the fact that we can now
have comma-delimited criteria.
Syntax of Enhance Switch in java
Comments
Post a Comment