作者Su22 (装配匠)
看板java
标题[问题] SCJP 6题库126题:catch中有exception
时间Sun Aug 31 21:27:18 2014
大家好
我想问这题
31. //some code here
32. try{
33. //some code here
34. }catch(Some Exception se) {
35. //some code here
36. }finally{
37. //some code here
38. }
Under which three circumstances will the code on line 37 be executed? (Choose
three.)
A. The instance gets garbage collected.
B. The code on line 33 throws an exception.
C. The code on line 35 throws an exception.
D. The code on line 31 throws an exception.
E. The code on line 33 executes successfully
答案BCE
B跟E没什麽疑问
但
1.C在34行catch住exception并执行35行时若又发生错误
不会中断整个执行并将错误的exception先丢出吗?
2.选项A是干什麽的?感觉跟这题没什麽关系?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.227.75.243
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/java/M.1409491641.A.187.html
1F:→ kuangjc5566: A选项来乱的。若35行throw exception,还是会执行 fin 09/01 02:55
2F:→ kuangjc5566: ally区块,然後更外层的try会尝试接这个exception。fi 09/01 02:55
3F:→ kuangjc5566: nally 区块除非遇到System.exit(),不然finally区块 09/01 02:55
4F:→ kuangjc5566: 都会被执行。 09/01 02:55
5F:→ Su22: 感谢大大! 09/01 23:34