沉默奔跑者

          記錄學習軌跡
          隨筆 - 1, 文章 - 2, 評論 - 5, 引用 - 0
          數據加載中……

          使用命令行參數

          public class CommandLineParam {
              
          public static void main(String args[]){
                  
          int a1,a2,a3;
                  
          if(args.length<2)
                  
          {
                      System.out.println(
          "Not Enough command line parameters is provideed");
                  System.exit(
          0);
                  
                  }

                  a1
          =Integer.parseInt(args[0]);
                  a2
          =Integer.parseInt(args[1]);
                  a3
          =a1+a2;
                  System.out.println(
          "Add"+a1+"with"+a2+"result in"+a3);
              }

          }

          /*D:\Program Files\Xinox Software\JCreatorV3\MyProjects\ccx9>java CommandLineParam
           31  -9
          Add31with-9result in22
          */

          posted on 2008-03-11 09:44 沉默奔跑者 閱讀(408) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 汝南县| 石首市| 大荔县| 福清市| 宁德市| 盐源县| 敖汉旗| 陆川县| 南阳市| 昭苏县| 双城市| 嘉祥县| 蓝山县| 波密县| 山阳县| 伽师县| 贵南县| 黑水县| 信宜市| 尉氏县| 淳安县| 顺平县| 榆中县| 汝城县| 寿光市| 同江市| 萨迦县| 永嘉县| 双柏县| 铁岭市| 察哈| 津市市| 维西| 进贤县| 天峨县| 囊谦县| 玉屏| 正定县| 安福县| 南岸区| 息烽县|