返回列表 發帖

1217 輸入兩數值相加

代入兩個參數...
9 r- b+ A+ ~5 s! R! D' Z0 r9 R5 w9 w, Y- @  Q6 H8 b
並且相加、減、乘、除

  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

public class d1217{
% z/ b/ @- }$ {- X0 ?) [: N. @
) G! i% i. t- u+ n* h3 x+ M5 v$ D    public static void main(String[] arg){, B5 M. }7 o7 o' Y  U; p: N

& P5 x+ i! f7 |) f, q% \+ c! k            //if(arg.length<2)return ;
! X! L+ C* f9 I8 ?0 s  a
; H8 x7 G6 D; K3 \( Q                try{
7 @& h2 U3 R5 w( S; Y$ a. d, f; S& U/ \9 P6 `& ?  k* }9 t! s" A& l, F
                    System.out.println(Integer.parseInt(arg[0])+Integer.parseInt(arg[1]));
: P  B5 d( z2 }- V8 a
3 P6 P" c! i$ A0 ^                }catch(Excrption e){) L2 c( y9 Z1 ~4 C! q) O/ |0 z1 r
, G% h4 b  Y  A9 o
                System.out.println("參數不足啦"+e.toString());$ k$ O+ b* p$ Z0 O" I5 Q% J( Z$ C

5 Q4 ]8 f! T: T# w; P        }% e  @3 W" W3 S5 l. E
& s8 d  H) n1 q: x6 S! B2 p
}
人平

TOP

返回列表