正在加载图片...
抛出异常的例子 public Rational divide (Rational r)throws Exception { if (r.numer ==0) { throw new Exception(denominator cannot be zero"); } long n numer*r.denom; long d denom*r.numer; return new Rational(n,d); ©2006计算机系杨厚群 All rights lefts reserved.©2006 计算机系 杨厚群 All rights & lefts reserved. 抛出异常的例子 public Rational divide(Rational r) throws Exception { if (r.numer == 0) { throw new Exception("denominator cannot be zero"); } long n = numer*r.denom; long d = denom*r.numer; return new Rational(n,d); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有