- import java.lang.*; //類別庫,常用,自動載入,可忽略
- import java.io.Console; // 抓使用者key 鍵盤時會用到
- public class ch08//類別
- {
- public static void main (String arg[]) //方法
- {
- Console cs=System.console(); //宣告cs
- int score;
- System.out.print("請輸入你的分數 :");
- score=Integer.parseInt(cs.readLine());
- if (score==100)
- {
- System.out.print("哇 您真是太厲害了 滿分耶!");
- }else if (score<100 && score>=60 )
- {
- System.out.print("及格了唷!");
- }else if (score>0 && score <60)
- {
- System.out.print("下次再加油 好嗎?");
- }else if (score==0)
- {
- System.out.print("零分...");
- }else
- {
- System.out.print("嘿! 不要亂輸入唷");
- }
- }
- }
複製代碼 |