diff --git a/doc/软件需求规格说明书.doc b/doc/软件需求规格说明书.doc new file mode 100644 index 0000000..844790b Binary files /dev/null and b/doc/软件需求规格说明书.doc differ diff --git a/src/abnormal.java b/src/abnormal.java new file mode 100644 index 0000000..28fc2eb --- /dev/null +++ b/src/abnormal.java @@ -0,0 +1,26 @@ +package day16; + +public class abnormal { + public static void main(String[] args) { + int a=10; + int b=0; + int[]arry = new int[4]; + try{ + System.out.println(a/b); + System.out.println( arry[10]); + + } + catch(ArithmeticException c){//小范围放在前面,范围大的放在后面,小的返回不在运行 + System.out.println("运算错误"); + + } + catch(ArrayIndexOutOfBoundsException c){ + System.out.println("您的数组超出索引长度"); + + } + catch(Exception c ){//Exception c = new NullException()父类引用在指向子类对象 + // Exception可以接受所有的子类对象,在实际开发中就只写这一行就可以了,不用写太多catch + System.out.println("出错啦"); + } + } +}