摘要: 1 package p1.exception; 2 3 /* 4 * 异常的注意事项: 5 * 6 * 1,子类在覆盖父类方法时,父类的方法如果抛出了异常, 7 * 那么子类的方法只能抛出父类的异常或者该异常的子类。 8 * 9 * 2,如果父类抛出多个异常,那么子类只能抛出父类异常的子集。 10 阅读全文
posted @ 2021-11-04 23:01 doremi429 阅读(11) 评论(0) 推荐(0)
摘要: 1 package p1.exception; 2 3 4 /* 5 * 老师用电脑上课。 6 * 7 * 问题领域中涉及两个对象。 8 * 老师,电脑。 9 * 10 * 分析其中的问题。 11 * 比如电脑蓝屏。冒烟。 12 * 13 */ 14 15 class LanPingExceptio 阅读全文
posted @ 2021-11-04 22:45 doremi429 阅读(26) 评论(0) 推荐(0)
摘要: 1 package p1.exception; 2 3 4 class Demo_0{ 5 public int show(int index) throws ArrayIndexOutOfBoundsException{ 6 if (index<0) { 7 throw new ArrayInde 阅读全文
posted @ 2021-11-04 21:38 doremi429 阅读(23) 评论(0) 推荐(0)