SCJP 1.6版考題 126

出自 陳富國維基館
前往: 導覽搜尋
Given:
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

解答


Ans: B C E

解說: finally必然執行的區塊,try中的敘述有發生無發生例法都會執行