多项选择题
现有
1. class Calc {
2. public static void main(String [] args) {
3. try {
4. int x = Integer.parselnt ("42a") ;
5. //insert code here
6. System.out.print ("oops");
7. }
8. }
9. }
下面哪两行分别插入到第五行,会导致输 "oops" ? ()
A. } catch (IllegalArgumentException e) {
B. } catch (IllegalStateException c) {
C. } catch (NumbelFormatException n) {
D. } catch (ClassCastException c) {
点击查看答案&解析
相关考题
-
单项选择题
现有: void topGo() { try { middleGo(); } catch (Exception e) { System.out.print("catch"); } } void middleGo() throws Exception { go(); system.out.print("late middle"); } void go() throws ExceptiOn { throw new Exception(); } 如果调用 topGo () ,则结果为:()
A. late middle
B. catch
C. late middle catch
D. catch Iate middle -
单项选择题
现有: class Number{ public static void main(String [] aras) { try { System.out.print (Integer.parselnt ("forty")); } catch (RuntimeException r) { System.out.print ("runtime"); } catch (NumberFormatException e) { system..ut.print("number"); } } } 结果是什么?()
A.number
B.runtime
C.forty number
D.编译失败 -
单项选择题
在方法的声明中,要求该方法必须抛出异常时使用哪个关键字?()
A. throw
B. catch
C. finally
D. throws
