沉默奔跑者

          記錄學習軌跡
          隨筆 - 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)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 崇文区| 凉山| 土默特右旗| 桂林市| 札达县| 永和县| 湖北省| 白朗县| 武宁县| 巫山县| 威信县| 台东市| 隆德县| 阿合奇县| 克东县| 融水| 江城| 称多县| 遵义县| 来宾市| 巨野县| 卢氏县| 依安县| 清河县| 迁西县| 板桥市| 肥城市| 手游| 潢川县| 呼图壁县| 江津市| 屏东市| 平阳县| 赫章县| 融水| 原平市| 太湖县| 新乡县| 赤水市| 仁布县| 宝鸡市|