Switch in Java17
As we all know that Java is going through revolutionary changes & with every release we see something new.
We all are familiar to Switch in Java, but what it was.
We all know that, we also called it Switch statements and those did mutation many times.
Then Java12 gave expressions to Switch.
Now we have both features, Statement & Expressions, in switch. We can use any whatever fits to our requirement.
But, keep in mind, we can't mix both, as statement doesn't return anything but expression does.
Below I have tried to show all the features around expressions available till Java17.
If you want to check this evolution in different Java versions then check -
The Evolution Of Switch Statement From Java 7 to Java 17 | by Java Techie | Medium
We all are familiar to Switch in Java, but what it was.
We all know that, we also called it Switch statements and those did mutation many times.
Then Java12 gave expressions to Switch.
Now we have both features, Statement & Expressions, in switch. We can use any whatever fits to our requirement.
But, keep in mind, we can't mix both, as statement doesn't return anything but expression does.
Below I have tried to show all the features around expressions available till Java17.
If you want to check this evolution in different Java versions then check -
The Evolution Of Switch Statement From Java 7 to Java 17 | by Java Techie | Medium
Switches