- import java.util.Scanner;
- public class Ch44 {
- public static void main(String[] args) {
- int ans;
- Scanner s=new Scanner(System.in);
- System.out.println("<簡單的小學知識題>");
- System.out.println("請問過年到紅包為發生什麼事?(1)自己存起來 (2)跟媽媽五五分(3)被媽媽收走,長大再還你 (4)被媽媽收走,長大了還是不會還你 ");
- while(true)
- {
- System.out.println("請回答:");
- ans=s.nextInt();
- 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("沒有這個答案不要再逃避了");
- }
- }
- }
- }
複製代碼 |