This is a preview language feature in JDK 13. It's a new feature of the Java SE Platform that is fully implemented and yet impermanent. This may become permanent in a future Java SE Platform.
Java 13 Switch Expression, Example:
Notice: You don't have to use breaks statement syntax,
You can just do,
yield - new keyword to return a value from switch expression
Another way,
In order to use preview feature you need to enable it, otherwise you will get the following error:
IntelliJ IDEA v2019.3 support preview feature
Enable Preview feature - IntelliJ
Open File => Project Structure. Under Project language level, choose: 13 (Preview) - Switch expressions, text blocks.