标签:
程序代码:
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("请输入两个小数!"); } } }
标签:
原文地址:http://www.cnblogs.com/simayige/p/5444493.html