Sun Java程序员认证考试题库(10)

2019-08-20 19:56

· 下列哪些是正确的?(选三项] A.p0=pl; B.p1 =p2; C.p2=p4;

D.p2 = (ClassC)pl; E.p1 = (ClassB)p3; F.p2 = (Classc)p4;

1-46

参考答案 1AC 2AB 3A 4ABD 5AB 6C 7C 8B 9ABC 10 D 11 B 12 A 13 B 14 B 15AEF

1-47

第八章练习题(异常)

1.Java语言中异常的分类是哪项? A.运行时异常和异常 B.受检异常和非受检异常 C.错误和异常

D.错误和运行时异常

确的是 2.所有异常的父类是哪项? A. Throwable B. Error

C. RuntimeException D. Exception 3.关于try...catch...finally结构,描述正确的是哪项? (选两项) A.可以有多个catch B.只能有一个catch C.可以没有catch D.finally必须有 4.下列属于非受检异常的是哪项? A.SQLException B. IOException

C. NullPointerException D.OutOfMemoryError 5.假设有自定义异常类ServiceException,那么抛出该异常的语句正哪项?

A. raise ServiceException

B. throw new ServiceException() C. throw ServiceException D. throws ServiceException

1-48

6.在方法的声明中,要求该方法必须抛出异常时使用哪个关键字? A. throw B. catch C. finally D. throws

7.现有:

1. class Number{

2. public static void main(String [] aras) { 3. try {

4. System.out.print (Integer.parselnt (\; 5. } catch (RuntimeException r) { 6. System.out.print (\

7. } catch (NumberFormatException e) { 8. system..ut.print(\ 9. } 10. } 11. }

结果是什么? A. number B. runtime

C. forty number D.编译失败

8.现有:

9. void topGo() { 10. try {

11. middleGo();

12. ) catch (Exception e) { 13. System.out.print(\ 1 4. } 15. }

1 6. void middleGo() throws Exception { 17. go();

1 8. system.out.print(\ 1 9. }

2. void go() throws ExceptiOn { 21. throw new Exception(); 22. }

1-49

如果调用 topGo () ,则结果为: A. late middle B. catch

C. late middle catch D. catch Iate middle

9.现有

1. class Calc {

2. public static void main(String [] args) { 3. try {

4. int x = Integer.parselnt (\ 5. //insert code here

6. System.out.print (\ 7. } 8. } 9. }

下面哪两行分别插入到第五行,会导致输 \选两项) A. } catch (IllegalArgumentException e) { B. } catch (IllegalStateException c) { C. } catch (NumbelFormatException n) { D. } catch (ClassCastException c) {

10.现有:

1. class Flow {

2. public static void main(String [] args) t 3. try {

4 . System. out .print (\ 5 . doRiskyThing ( ) ; 6. System.out.print (\ 7. } catch (Exception fe) {

8. System.out.print (\ 9. }

10 . System. out .println ( \ 11. }

12. public static void doRiskyThing() throws Exception{ 13. // this code returns unless it throws an Exception }}

可能会产生哪两项结果 ?(选两项) A. before catch

B. before after done C. before catch done D. before after catch

1-50


Sun Java程序员认证考试题库(10).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:targetscan

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: