返回列表 發帖
  1. import java.io.Console;
  2. public classCh08
  3. {
  4.      public static void main(String args[])
  5.      {
  6.          int ans;
  7.          Console c=System.console();
  8.          System.out.println("~史派克問答~");
  9.          System.out.println("請問史派克有幾根刺(1)0根(2)2根(3)46根(4)157根");
  10.          System.out.println("請作答:");
  11.          ans=Integer.parseInt(c.readLine());
  12.          switch(ans)
  13.          {
  14.            case 1:
  15.               System.out.println("錯了");
  16.               break;
  17.            case 2:
  18.               System.out.println("對了");
  19.               break;
  20.            case 3:
  21.               System.out.println("錯了");
  22.               break;
  23.            case 4:
  24.               System.out.println("錯了");
  25.               break;
  26.            default:
  27.               System.out.println("輸入錯了");
  28.          }
  29.      }
  30. }
複製代碼

TOP

返回列表