|
// Java开关分支判断星期
|
|
package xiangmu;
|
|
|
|
public class Ceshi {
|
|
public static void main(String args[]) {
|
|
int xingqi = 3;
|
|
switch(xingqi) {
|
|
case 1:
|
|
dayin("星期一");
|
|
break;
|
|
case 2:
|
|
dayin("星期二");
|
|
break;
|
|
case 3:
|
|
dayin("星期三");
|
|
break;
|
|
case 4:
|
|
dayin("星期四");
|
|
break;
|
|
case 5:
|
|
dayin("星期五");
|
|
break;
|
|
default:
|
|
dayin("周末");
|
|
}
|
|
}
|
|
public static void dayin(String zifuchuan) {
|
|
System.out.println(zifuchuan);
|
|
}
|
|
}
|