第八次做業

public class JavaSeven {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
          try{
               double d0=Double.parseDouble(args[0]);
               double d1=Double.parseDouble(args[1]);
               if(d1==0)throw new ArithmeticException();
               double result=d0/d1;
               System.out.println(result);
              }catch(ArithmeticException ae){
               System.out.println("除數不能爲零!");
              }catch(NumberFormatException nfe){
               System.out.println("請輸入兩個小數!");
              }
    }

}
相關文章
相關標籤/搜索