可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

1. public class a&#


1. public class a {  2. public void method1() {  3. try {  4. B b=new b();  5. b.method2();  6. // more code here  7. } catch (TestException te) {  8. throw new RuntimeException(te);  9. }  10. }  11. }  1. public class b {  2. public void method2() throws TestException {  3. // more code here  4. }  5. }  1. public class TestException extends Exception {  2. }  Given:  31. public void method() {  32. A a=new a();  33. a.method1();  34. }  Which is true if a TestException is thrown on line 3 of class b?()

  • A Line 33 must be called within a try block.
  • B The exception thrown by method1 in class a is not required to be caught.
  • C The method declared on line 31 must be declared to throw a RuntimeException.
  • D On line 5 of class a, the call to method2 of class b does not need to be placed in a try/catch block.
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、若a=5,b=3,c=4,逻辑表达式!(a+b)&;&;!c的值

若a=5,b=3,c=4,逻辑表达式!(a+b)&;&;!c的值为()A0B-1C1D2

2、现有int a,*b;,b=&a;,则下列运算错误的是

现有int a,*b;,b=&a;,则下列运算错误的是A*&aB&*aC*&bD&*b

3、若有定义语句:double a,+P=&;a;以下叙述中错误的是( )

若有定义语句:double a,+P=&a;以下叙述中错误的是( )。A定义语句中的*号是一个问址运算符B定义语句中的*号是一个说明符C定义语句中的P只能存放double类型变量的地址...

4、表达式10>5&&6%3的值是()

表达式10>5&&6%3的值是()A-1B非零值C0D1

5、有如下程序段int *p,a=10,b=1;p=&a; a=*p+b

有如下程序段int *p,a=10,b=1;p=&a; a=*p+b;执行该程序段后,a的值为A.12 B.10 C.11 D.编译出错A12 B10 C11 D编译出错

6、有如下程序段int *p,a=10,b=1;p=&a; a=*p+b

有如下程序段int *p,a=10,b=1;p=&a; a=*p+b;执行该程序段后,a的值为A12B11C10D编译出错