Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Switch statement expressions jdk12+

switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
    case TUESDAY                -> System.out.println(7);
    case THURSDAY, SATURDAY     -> System.out.println(8);
    case WEDNESDAY              -> System.out.println(9);
}
Source by openjdk.java.net #
 
PREVIOUS NEXT
Tagged: #Switch #statement #expressions
ADD COMMENT
Topic
Name
7+8 =