How to use BigInteger in Java - 2
May 31, 2023
1 min
Switch statements are used in the following format.
switch(expression) {case x:Code to execute if expression is xbreak;case y:Code to execute if expression is ybreak;default:Code to execute when the expression is neither x nor y}
public static void main(String[] args) {int day = 2;switch (day) {case 1:System.out.println("Monday");break;case 2:System.out.println("Tuesday");break;case 3:System.out.println("Wednesday");break;case 4:System.out.println("Thursday");break;case 5:System.out.println("Friday");break;case 6:System.out.println("Saturday");break;case 7:System.out.println("Sunday");break;}}