Board logo

標題: if...else 判斷式 [打印本頁]

作者: tonyh    時間: 2021-1-22 10:42     標題: if...else 判斷式





  >    大於
  <    小於
  ==  等於
  >=  大於或等於
  <=  小於或等於
  !=   不等於


本帖隱藏的內容需要回復才可以瀏覽

作者: 吳聲寬    時間: 2021-1-22 10:57

  1. import java.io.Console;
  2. public class Ch08
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         Console c=System.console();
  7.         int age;
  8.         age=Integer.parseInt(c.readLine("Enter your age: "));
  9.         if(age>=18)
  10.         {
  11.             System.out.println("You can have your license test!");
  12.         }
  13.         else
  14.         {
  15.             System.out.println("You still need to wait...");
  16.         }
  17.     }
  18. }
複製代碼

作者: 王博裕    時間: 2021-1-22 10:58

  1. import java.io.Console;
  2. public class Ch02
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         Console c=System.console();
  7.         int age;
  8.         System.out.print("輸入年紀");
  9.         age=Integer.parseInt(c.readLine());
  10.         if(age>=18)
  11.             System.out.println("可以考駕照了");
  12.         else
  13.             System.out.println("再等等");
  14.     }
  15. }
複製代碼

作者: 楊澤全    時間: 2021-1-22 10:58

  1. import java.io.Console;
  2. public class Ch04
  3. {
  4.   public static void main(String args[])
  5.   {
  6.     Console a=System.console() ;
  7.     int age;
  8.     age=Integer.parseInt(a.readLine("請輸入你的年紀:"));
  9.     if(age>=18)
  10.     System.out.print("恭喜!可以考駕照了!");
  11.     else
  12.     System.out.print("未滿18,再等等喔!");
  13.   }

  14. }
複製代碼

作者: 李柏穎    時間: 2021-1-22 10:58

  1. import java.io.Console;
  2. public class Ch04
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int a;
  7.         Console c=System.console();
  8.         a=Integer.parseInt(c.readLine("請輸入年紀: "));
  9.         if(a>=18)
  10.             System.out.println("恭喜你!可以考駕照了");
  11.         else
  12.             System.out.println("未滿18,再等一等喔!");
  13.     }
  14. }
複製代碼

作者: 紀承典    時間: 2021-1-22 10:59

  1. import java.io.Console;
  2. public class Ch06
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          Console c=System.console();
  7.          int age=Integer.parseInt(c.readline("請輸入你的年紀: "));
  8.          if(age>=18)
  9.               System.out.println("可以考駕照了!");
  10.          else
  11.               System.out.println("再等等~~");
  12.     }
  13. }
複製代碼

作者: 王睿宇    時間: 2021-1-22 10:59

  1. import java.io.Console;
  2. public class Ch04
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int n;
  7.         Console c=System.console();

  8.         n=Integer.parseInt(c.readLine("輸入你的年齡: "));
  9.         
  10.         if(n>=18)
  11.             System.out.println("恭喜!可以考駕照了");
  12.         else
  13.             System.out.println("未滿18,再等等喔~");
  14.     }
  15. }
複製代碼

作者: 藍健洲    時間: 2021-1-22 11:02

  1. import java.io.Console;
  2. public class Ch08
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          Console c=System.console();
  7.          int age=Integer.parseInt(c.readLine("請輸入你的年紀"));
  8.          if(age>=18)
  9.              System.out.println("可以考駕照了");
  10.          else
  11.              System.out.println("再等等");
  12.     }
  13. }
複製代碼

作者: 卓炘暘    時間: 2021-1-22 11:02

  1. import java.io.Console;
  2. public class Ch08
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         Console c=System.console();
  7.         int age;
  8.         System.out.print("請輸入你的年紀: ");
  9.         age=Integer.parseInt(c.readLine());
  10.         if(age>=18)
  11.             System.out.println("可以考駕照了!");
  12.         else
  13.             System.out.println("還要再等等喔!");
  14.     }

  15. }
複製代碼

作者: 楊小萱    時間: 2021-1-22 11:03

  1. import java.io.Console;
  2. public class Ch06
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         int age;
  7.         Console c=System.console();
  8.         System.out.print("輸入年紀:");
  9.         age=Integer.parseInt(c.readLine());
  10.         if(age>=18)
  11.             System.out.println("恭喜!可以考駕照了!");
  12.         else
  13.             System.out.println("未滿18,還得再等一等喔!");
  14.     }
  15. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2