import java.util.Scanner;
public class dfdsf {
/**
* @param args */public static void main(String[] args) {
int id=1;
boolean flag=true;
String[] week = {"星期壹","星期二","星期三","星期四","星期五","星期六","星期日"};//定義星期的字符數組
Scanner input = new Scanner(System.in);//建立輸入的壹個對象
while(flag==true){
//tru /catch用來拋出妳輸入的非數字的異常,即如果妳輸入的是數字就運行try,否則運行catch
try {
System.out.println("請輸入:");
id=input.nextInt();//從接受臺接受數據if(id<0||id>7){
System.out.println("請重新輸入!");//超出範圍的數字,要重新輸入
}else{
//這個if是對妳列出的條件進行編譯
if(id>=0&&id<8){
if(id==0){ flag = false; }else{ System.out.println(week[id-1]); }}
}
} catch (Exception e) {
System.out.println("本回合結束,請重新啟動程序!");
flag = false;//非數字,回合結束
}
}
}
}