Community
Participate
Working Groups
switch (day) { case MONDAY, TUESDAY -> 1; case WEDNESDAY, THURSDAY, FRIDAY -> 2; case SATURDAY, SUNDAY -> { System.out.println("End of the Week"); break 3; } }; This leads to compiler error "Invalid expression as statement". We can have a quick fix to assign the value of Switch expression to a local variable to fix this error.