Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Switch Java 12 on the SSaurel's Channel
public static boolean boolean isWeekend(String day) {
return switch (day) {
case "mon", "tue", "wed", "thu", "fri" -> false;
case "sat", "sun" -> true;
default -> {
if (day.startsWith("s")) {
System.out.println("It seems to be a weekend day");
break true;
System.out.printf("Unknown day: %s%n", day);
break false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment