2009年2月16日 星期一

第135題

Given:
84. try{
85. ResourceConnection con = resourceFactory.getConnection();
86. Results r = con.query("GET INFO FROM CUSTOMER");
87. info = r.getData();
88. con.close();
89. }catch(ResourceException re){
90. errorLog.write(re.getMessage());
91. }
92. return info;

Which statement is true if a ResourceException is thrown on line 86?

A. Line 92 will not execute.
B. The connection will not be retrieved in line 85.
C. The resource connection will not be closed on line 88.
D. The enclosing method will throw an exception to its caller.
答案:C

參考:9-2 Java例外事件與處理機制。
-------------------------------------------------------------------
題目說第86行會產生ResourceException
所以第88 行不會被run到

沒有留言:

張貼留言