2009年2月16日 星期一

第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

答案:BCE
參考:9-2 Java例外事件與處理機制

------------------------------------------------------------------
第37行在何情況下會被執行?
在33或35行執行過不管成功與否都會執行第37行
但第31行如果發生問題的話就不會執行第37行

沒有留言:

張貼留言