题目内容

下列关于异常的描述,错误的是( )

A. printStackTrace()用来跟踪异常事件发生时执行堆栈的内容
B. catch块中可以出现同类型异常
C. 一个try块可以包含多个catch块
D. 捕获到异常后将输出所有catch语句块的内容

查看答案
更多问题

类及其子类所表示的异常是用户程序无法处理的()

A. NumberFormatException
B. Exception
C. Error
D. RuntimeException

数组下标越界,则发生异常,提示为()

A. IOException
B. ArithmeticException
C. SQLException
D. ArrayIndexOutOfBoundsException

运行下列代码,当输入的num值为a时,系统会输出 ( )public static void main(String[] args){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");}

A. one three end
B. two three end
C. one two three end
D. two end

运行下列代码,输出结果为 ()public static void main(String[] args){try {int a = 1-1;System.out.println("a = " + a);int b = 4 / a;int c[] = {1};c[10] = 99;} catch(ArithmeticException e) {System.out.println("除数不允许为0");} catch(ArrayIndexOutOfBoundsException e) {System.out.println("数组越界");}}

A. a = 0
B. a = 0除数不允许为0
C. a = 1数组越界
D. a = 0除数允许为0

答案查题题库