java switch

java switch statement

#java #switch #statement

public class main {

public static void main(string[] args) {

// switch = statement that allows a variable to be tested for equality against a list of values

string day = "friday";

switch(day) {
case "sunday": system.out.println("it is sunday!");
break;
case "monday": system.out.println("it is monday!");
break;
case "tuesday": system.out.println("it is tuesday!");
break;
case "wednesday": system.out.println("it is wednesday!");
break;
case "thursday": system.out.println("it is thursday!");
break;
case "friday": system.out.println("it is friday!");
break;
case "saturday": system.out.println("it is saturday!");
break;
default: system.out.println("that is not a day!");
}

}
}

java switch