没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
1.所有异常的父类是哪项? A 通过 API 查看可知
A. Throwable
B. Error
C. RuntimeException
D. Exception
2.现有: BC 两种情况,一种是没有异常,一种是有异常
1. class Flow {
2. public static void main(String [] args) t
3. try {
4 . System. out .print ("before") ;
5 . doRiskyThing ( ) ;
6. System.out.print ("after ") ;
7. } catch (Exception fe) {
8. System.out.print ("catch") ;
9. }
10 . System. out .println ( " done") ;
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
3.现有: D 继承的 utils,Utils 里面的方法没有抛出异常,而重写的时候抛出了异
常,这样是不允许的,两者应该同步
1. class Parser extends Utils (
2.public static void main (String[] args) {
3.try{System.out.print (new Parser().getlnt("42"));
4. } catch (Exception e) {
5.System.out.println("Exc"); }
6. }
7.int getlnt (String arg) throws Exception (
8.return Integer.parselnt (arg);
9. }
10. }
11. class Utils {
12. int getlnt (String arg) {return 42; }
13. }
结果为:
A. 42
资源评论
Rindy_RR
- 粉丝: 46
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功