码迷,mamicode.com
首页 > 编程语言 > 详细

JAVA第八次作业

时间:2016-04-28 22:41:50      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

程序代码:

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

}

 

JAVA第八次作业

标签:

原文地址:http://www.cnblogs.com/simayige/p/5444493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!