Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

switch expression java

System.out.println(
        switch (day) {
            case MONDAY, FRIDAY, SUNDAY -> 6;
            case TUESDAY                -> 7;
            case THURSDAY, SATURDAY     -> 8;
            case WEDNESDAY              -> 9;
            default -> throw new IllegalStateException("Invalid day: " + day);
        }
    );
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #switch #expression #java
ADD COMMENT
Topic
Name
1+9 =