In a switch expression, when a switch branch isn't returning a value, it can execute a single statement, a block of statements, or even throw an exception. In the following example, the switch statement is not returning a value. It executes a single statement (prints out a value) for the case label, Sun; executes a block of code for the case labels, Mon and Tue; and throws an exception for its default case:
String day = // assign a value here
switch(day) {
case "Sun" -> System.out.println("OSS-Jav");
case "Mon", "Tue" -> {
// some simple/complex code
}
default -> throw new RuntimeException("Running out of projects");
}