106运用SWITCH语句打印星期几的单词

时间:2022-07-13 07:44:43

package com.chongrui.test;
/*
运用SWITCH语句打印星期几的单词
* */

public class TypeConvertion {

public static void main(String[] args){

System.out.println("今天星期几");
int week = 6;
switch(week){
case 1:  //case后面要常量
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");
default:
System.out.println("Sorry,I don't know");
break;

}


}

}