第八次作业

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("请输入两个小数!");
              }
    }

}

 

posted on 2016-05-10 13:07  123hh6m  阅读(96)  评论(0)    收藏  举报

导航