Board logo

標題: 資料輸入 (五) - 參數傳值法 [打印本頁]

作者: tonyh    時間: 2017-3-11 10:54     標題: 資料輸入 (五) - 參數傳值法

本帖最後由 tonyh 於 2017-3-11 11:01 編輯

利用參數傳值法來做資料輸入.

  1. public class Ch45
  2. {
  3.      public static void main(String args[])
  4.      {
  5.            System.out.println("您剛輸入的參數依序為...");
  6.            for(int i=0; i<args.length; i++)
  7.                System.out.println("args["+i+"]="+args[i]);
  8.      }
  9. }
複製代碼

作者: 林侑成    時間: 2017-3-11 11:05

  1. public class Ch40
  2. {
  3.     public static void main(String args[])
  4.     {
  5.        System.out.println("您剛輸入的參數依序為...");
  6.        for(int i=0; i<args.length; i++)
  7.           System.out.println("args["+i+"]="+args[i]);
  8.     }
  9. }
複製代碼

作者: 陳泓瑜    時間: 2017-3-11 11:06

  1. public class Ch36
  2. {
  3.    public static void main(String args[])
  4.    {
  5.       System.out.println("你剛輸入的參數依序為.............");
  6.       
  7.       for(int i=0; i<args.length; i++)
  8.         System.out.println("args["+i+"]="+args[i]);


  9.    }
  10. }
複製代碼

作者: 陸長辰    時間: 2017-3-25 09:48

  1. public class Ch41
  2. {
  3.      public static void main(String args[])
  4.      {
  5.            System.out.println("您剛輸入的參數依序為...");
  6.            for(int i=0; i<args.length; i++)
  7.                System.out.println("args["+i+"]="+args[i]);
  8.      }
  9. }
複製代碼

作者: 黃茂勛    時間: 2017-3-25 09:48

  1. import java.util.Scanner;
  2. public class Ch45
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          System.out.println("您剛剛輸入的參數依序為...");
  7.          for(int i=0; i<args.length; i++)
  8.            System.out.println("args["+i+"]="+args[i]);
  9.     }
  10. }
複製代碼





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