返回列表 發帖

1217 輸入兩數值相加

代入兩個參數...
3 |. u: f9 H5 d) l: T1 |9 S# g5 W' d* m: ^* }$ p* u! ?
並且相加、減、乘、除

public class d1217{% w8 }  X' ~1 l: ~
, @1 n2 w2 k% [0 ~4 o: I
    public static void main(String[] arg){. u3 k6 ^: G! M0 {5 X# D

9 Y1 z3 Y4 h- a) q3 \; `' H+ X            //if(arg.length<2)return ;( A/ B3 u6 ]8 n% F$ V3 O: E8 G

7 S3 o! m6 Q0 M, P: |' W8 `' J! s  B                try{
# z! N$ a7 P' s: G- R% n. m( ^/ V+ V7 Q7 K7 y
                    System.out.println(Integer.parseInt(arg[0])+Integer.parseInt(arg[1]));' H$ r" x8 N" L; s
$ u5 ~/ d1 R) r* k( r
                }catch(Excrption e){- S$ V2 N7 A: a7 R$ X, c

; @* O1 I3 f, b  B  S                System.out.println("參數不足啦"+e.toString());% K% g( p; P: T& I, C! ?

/ C4 Z8 o+ B- S: T( T) W        }
0 O" c; L. h/ @/ R4 j: L2 M
9 z3 n0 G; n4 k6 g1 J- ^9 ?; a}
人平

TOP

  1. public class d1217{
  2.     public static void main(String[] arg){
  3.             //if(arg.length<2)return ;
  4.                 try{
  5.                     System.out.println(Integer.parseInt(arg[0])+Integer.parseInt(arg[1]));
  6.                 }catch(Excrption e){
  7.                 System.out.println("參數不足"+e.toString());
  8.         }
  9. }
複製代碼
★ 嘉凱~~☆

TOP

返回列表