- import java.io.Console;
- public classCh08
- {
- public static void main(String args[])
- {
- int ans;
- Console c=System.console();
- System.out.println("~史派克問答~");
- System.out.println("請問史派克有幾根刺(1)0根(2)2根(3)46根(4)157根");
- System.out.println("請作答:");
- ans=Integer.parseInt(c.readLine());
- switch(ans)
- {
- case 1:
- System.out.println("錯了");
- break;
- case 2:
- System.out.println("對了");
- break;
- case 3:
- System.out.println("錯了");
- break;
- case 4:
- System.out.println("錯了");
- break;
- default:
- System.out.println("輸入錯了");
- }
- }
- }
複製代碼 |