The version 12 of Java comes with a new preview feature (amongst others): Switch Expressions. Let���s see how this feature can simplify some of our daily tasks.
[image error]
Java 12���s Simplified Switch Block Classic switch block in Java
Before the release of this new preview feature, the only way to write a switch block in Java implies the usage of case:��(with a colon):
int numDays; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: numDays = 31; break; case 4: case 6: case 9:...
Published on January 06, 2019 22:34