Compile a JDK12 preview feature with Maven
With JDK/12 EarlyAccess Build 10 , the JEP-325 Switch Expressions has been integrated as a preview feature in the JDK. A sample code for the expressions (as in the JEP as well): Scanner scanner = new Scanner(System.in); Day day = Day.valueOf(scanner.next()); switch (day) { case MONDAY, TUESDAY -> System.out.println("Back to work.") ; case WEDNESDAY -> System.out.println("Wait for the end of week...") ; case THURSDAY,FRIDAY -> System.out.println("Plan for the weekend?"); case SATURDAY, SUNDAY -> System.out.println("Enjoy the holiday!"); } where Day being an enum as public enum Day { MONDAY,