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

Class TestException  1.&ens


Class TestException  1. public class TestException extends Exception {  2. } Class a:  1. public class a {  2.  3. public String sayHello(String name) throws TestException {  4.  5. if(name == null) {  6. throw new TestException();  7. }  8.  9. return “Hello “+ name;  10. }  11.  12. }  A programmer wants to use this code in an application: 45. A a=new A();  46. System.out.println(a.sayHello(”John”));  Which two are true?()

  • A Class a will not compile.
  • B Line 46 can throw the unchecked exception TestException.
  • C Line 45 can throw the unchecked exception TestException.
  • D Line 46 will compile if the enclosing method throws a TestException.
  • E Line 46 will compile if enclosed in a try block, where TestException is caught.
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

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

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

2、设N=44,M=55,K=”N+M”,表达式1+&K的值是( )。

设N=44,M=55,K=”N+M”,表达式1+&K的值是( )。AA)4456BB)100CC)1+M+NDD)数据类型不匹配

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

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

4、已知x,y,z均为整型变量,且值均为1,则执行语句++x||++y&

已知x,y,z均为整型变量,且值均为1,则执行语句++x||++y&&++z;后,表达式x+y的值为A1B2C3D4

5、1. class Synapse {&ens

1. class Synapse {  2. protected int gap() { return 7; }  3. }  4. &...

6、1. class Passer2 {&ens

1. class Passer2 {  2. //insert code here  3. static int bigState = 42;  4.&ens...