程序中抛出异常 本是古典 何须时尚 2022-08-25 09:12 195阅读 0赞 public class ThrowException { public static void main(String args[]) { try { int a=6,b=0; if(b==0) throw new ArithmeticException("算术异常!"); } catch(ArithmeticException x) { System.out.println("抛出的异常为:"+x); } } }
还没有评论,来说两句吧...