j002_java异常作业

1. 多选题
下列代码中的异常属于()(选择两项)
int a = 0;
System.out.println(2/a);
A 非检查型异常
B 检查型异常
C Error
D Exception

2. 单选题
()类及其子类所表示的异常是用户程序无法处理的。(选择一项)
A NumberFormatException
B Exception
C Error
D RuntimeException

3. 单选题
数组下标越界,则发生异常,提示为()(选择一项)
A IOException
B ArithmeticException
C SQLException
D ArrayIndexOutOfBoundsException

4. 单选题
运行下列代码,当输入的num值为a时,系统会输出()(选择一项)
Scanner input = new Scanner(System.in);
try {
int num = input.nextInt();
System.out.println("one");
}
catch(Exception e) {
System.out.println("two");
}
finally {
System.out.println("three");
}
System.out.println("end");

5. 多选题
下列关于异常的描述,错误的是()(选择两项)
A 多重catch应用时,父类异常捕获需要写在子类异常之后。
B catch块中可以出现同类型异常
C 一个try块可以包含多个catch块
D 捕获到异常后将输出所有catch语句块的内容

1. 单选题
假设有自定义异常类MyException,那么抛出该异常的语句正确的是()(选择一项)
A throw new Exception()
B throw new MyException()
C throw MyException
D throws Exception

原文地址:https://www.cnblogs.com/haizinihao/p/14756311.html