返回列表 發帖

if... else 判斷式

  1. import java.lang.*;
  2. import java.io.Console;
  3. public class ch07
  4. {
  5.    public static void main(String args[])
  6.    {
  7.         Console console=System.console();
  8.         int score;
  9.         System.out.print("請輸入你的成績: ");
  10.         score=Integer.parseInt(console.readLine());
  11.         if(score>=60)
  12.         {
  13.             System.out.println("恭喜你及格了!");
  14.         }else
  15.         {
  16.             System.out.println("不及格!下次再努力!");
  17.         }
  18.    }
  19. }
複製代碼

返回列表