You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it should be update to reflect that it's not preview feature now to deal with null using switch expression
maybe an example with little modification to that code that presented in same page under switch-syntax section
int day = ...; // any day
int len =
switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
}
System.out.println("len = " + len);
to be
Day day = null;
int len = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
case null -> -1;
};
System.out.println("len = " + len);
Activity