![](https://lstatic.shangxueba.com/jiandati/h5/images/m_q_title.png)
![](https://lstatic.shangxueba.com/jiandati/pc/images/logo2.png)
![给出如下代码段: try { int x = Integer.parseInt("two"); } 下列哪个可以作为catch的异常?](https://img2.soutiyun.com/shangxueba/askcard/2023-10/13/667/20231013095923533.jpg)
给出如下代码段: try { int x = Integer.parseInt("two"); } 下列哪个可以作为catch的异常?
A.ClassCastException
B.IllegalStateException
C.NumberFormatException
D.ExceptionInInitializerError
A.ClassCastException
B.IllegalStateException
C.NumberFormatException
D.ExceptionInInitializerError
A、No error in compilation
B、error at //line1 in compilation
C、error at //line2 in compilation
D、two errors at //line1 and //line2 in compilation
A、异常是一种经过修正后程序仍可执行的错误。
B、异常是一种程序在运行中出现的不可恢复执行的错误。
C、不仅Java语言有异常处理,C++语言也有异常处理。
D、出现异常不是简单结束程序,而是执行某种处理异常的代码,设法恢复程序的执行。
下列程序的执行,说法错误的是 (C) public class MultiCatch { public static void main(String args[]) { try { int a=args.length; int b=42/a; int c[]={1}; c[42]=99; System.out.println(“b=”+b); } catch(ArithmeticException e) { System.out.println( “除 0 异常: ” +e); } catch(ArrayIndexOutOfBoundsException e) { System.out.println( “数组超越边界异常: ” +e); } } } A 、程序将输出第 15 行的异常信息 下列程序的执行,说法错误的是: public class MultiCatch { public static void main(String args[]) { try { int a=args.length; int b=42/a; int c[]={1}; c[42] = 99; System.out.println(“b=”+b); } catch(ArithmeticException e) { System.out.println(“除0异常:”+e);} catch(ArrayIndexOutOfBoundsException e) { System.out.println(“数组超越边界异常:”+e); } } }
A、程序输出b=12
B、程序将输出第15和18行的异常信息
C、程序将输出第15行的异常信息
D、程序第10行出错
A、-
B、-c
C、-c2
D、-2c
A、No error in compilation
B、error at //line1 in compilation
C、error at //line2 in compilation
D、two errors at //line1 and //line2 in compilation
A、-ic mf of
B、-ic mc mf of
C、-ic mc of mf
D、Compilation fails
A、String doFileStuff() { return "b"; }
B、String doFileStuff() throws IOException { return "b"; }
C、String doFileStuff(int x) throws IOException { return "b"; }
D、String doFileStuff() throws Exception { return "b"; }
A、null
B、null null
C、A ClassCastException is thrown.
D、A NullPointerException is thrown.
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!