📄 scjp 的一些笔记.htm
字号:
CUSTOMER”);</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>87. info =
r.getData();</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>88. con.close();</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>89. } catch (ResourceException re)
{</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>90.
errorLog.write(re.getMessage());</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>91. }</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>92. return info;</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>Which is true if a ResourceException is thrown on
line 86?</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT face=Verdana>A. Line 92 will not
execute.<BR>//</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">异常未捕获,则会执行</FONT></FONT><FONT
face=Verdana><FONT
style="FONT-SIZE: 12pt"></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>B. The connection will not be retrieved in line
85.</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>C. The resource connection will not be closed on
line 88.</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT face=Verdana>D. The enclosing
method will throw an exception to its
caller.<BR>//</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">因为它被捕获,所以可以不被抛出异常</FONT></FONT><FONT
face=Verdana><FONT
style="FONT-SIZE: 12pt"></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT face=Verdana><FONT
color=#000000></FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT
face=Verdana>76.</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">异常是从</FONT></FONT><FONT
face=Verdana><FONT style="FONT-SIZE: 12pt"><FONT
face=Verdana>C</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">的方法产生的,</FONT></FONT><FONT
face=Verdana><FONT
style="FONT-SIZE: 12pt"></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT face=Verdana><BR>The exception
will be propagated back to line 27.</FONT></FONT></FONT><FONT
face=宋体><FONT style="FONT-SIZE: 12pt">?</FONT></FONT><FONT
face=Verdana><FONT
style="FONT-SIZE: 12pt"></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 10pt"><FONT
face=Verdana>77.</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">有抛出异常,就不要</FONT></FONT><FONT
face=Verdana><FONT style="FONT-SIZE: 12pt"><FONT
face=Verdana>try-catch</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT
face=Verdana>78.accessException</FONT></FONT></FONT><FONT
face=宋体><FONT style="FONT-SIZE: 12pt">属于</FONT></FONT><FONT
face=Verdana><FONT style="FONT-SIZE: 12pt"><FONT
face=Verdana>Throwable</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT
face=Verdana>80.try</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">可以不</FONT></FONT><FONT
face=Verdana><FONT style="FONT-SIZE: 12pt"><FONT
face=Verdana>catch,</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">此时要</FONT></FONT><FONT
face=Verdana><FONT style="FONT-SIZE: 12pt"><FONT
face=Verdana>finally,</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT face=Verdana><BR>catch
(Exception ex) { System.out.print(”exception “);
}</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">为什么会被捕获异常?</FONT></FONT><FONT
face=Verdana><FONT
style="FONT-SIZE: 12pt"></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT
face=Verdana>81.</FONT></FONT></FONT><FONT face=宋体><FONT
style="FONT-SIZE: 12pt">问题如下:</FONT></FONT><FONT
face=Verdana><FONT
style="FONT-SIZE: 10pt"></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>11. static void test() throws RuntimeException
{</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>12. try {</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>13. System.out.print(”test
“);</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>14. throw new
RuntimeException();</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><I><FONT
face=Verdana><FONT style="FONT-SIZE: 12pt">15.
</FONT></FONT></I><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt">}</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>16. catch (Exception ex) {
System.out.print(”exception “);
}</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>17. }</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>18. public static void main(String[] args)
{</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT color=#000000><FONT
face=Verdana>19. try { test();
}</FONT></FONT></FONT></FONT></P>
<P></P>
<P align=left>
<P align=left><FONT color=#000000><FONT face=Verdana><FONT
style="FONT-SIZE: 12pt"><FONT face=Verdana>20. catch
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -