⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scjp 的一些笔记.htm

📁 想考SCJP国际认证的必看这文档
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                  (RuntimeException ex) { System.out.print(”runtime “); 
                  }<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 color=#000000><FONT face=Verdana><FONT 
                  style="FONT-SIZE: 12pt"><FONT face=Verdana>21. 
                  System.out.print(”end “);} //</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: 10pt"><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>82.</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>11. public void someMethod(Object value) 
                  {</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. // check for null 
                  value</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>....</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>20. 
                  System.out.println(value.getClass());</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>21. }</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>What, inserted at line 12, is the appropriate way 
                  to handle a null</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>value?</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>A. assert value == 
                  null;</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>B. assert value !null, “value is 
                  null”;</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. if (value == null) 
                  {</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>throw new AssertionException(”value is 
                  null”);</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>D. if (value == null) 
                  {</FONT></FONT></FONT></FONT></P>
                  <P></P>
                  <P align=left>
                  <P align=left><FONT color=#000000><FONT face=Verdana><FONT 
                  face=Verdana><FONT style="FONT-SIZE: 12pt">throw new 
                  IllegalArgumentException(”value is null”);</FONT></FONT><FONT 
                  face=Verdana><FONT 
                  style="FONT-SIZE: 10pt"></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>83.NullPointException(</FONT></FONT></FONT><FONT 
                  face=宋体><FONT style="FONT-SIZE: 12pt">空指针异常</FONT></FONT><FONT 
                  face=Verdana><FONT style="FONT-SIZE: 12pt"><FONT 
                  face=Verdana>)</FONT></FONT></FONT></FONT></P>
                  <P></P></DIV><BR style="CLEAR: both"><FONT 
                  style="FONT: 9pt Tahoma, Verdana; COLOR: #313031"></FONT></TD></TR>
              <TR>
                <TD align=right><A onclick=scroll(0,0) 
                  href="http://www.spoto.net/bbs/viewthread.php?tid=12957&amp;page=1&amp;extra=page%3D1###"><IMG 
                  alt=顶部 src="scjp 的一些笔记.files/top.gif" border=0></A> 
              </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
      <DIV class=spaceborder style="MARGIN-BOTTOM: 4px; WIDTH: 100%">
      <TABLE class=t_row cellSpacing=0 cellPadding=5 width="100%" 
        align=center><TBODY>
        <TR style="HEIGHT: 100%">
          <TD class=t_user vAlign=top width="18%"><A name=pid71959></A><A 
            class=bold href="http://www.spoto.net/bbs/space-uid-4334.html" 
            target=_blank>allen_su</A> <BR>
            <DIV class=smalltxt>中级会员<BR><IMG alt="Rank: 4" 
            src="scjp 的一些笔记.files/star_level2.gif"><IMG alt="Rank: 4" 
            src="scjp 的一些笔记.files/star_level1.gif"><BR><BR>
            <TABLE style="TABLE-LAYOUT: fixed; OVERFLOW: hidden" cellSpacing=0 
            cellPadding=0 width="95%" border=0>
              <TBODY>
              <TR>
                <TD align=middle>
                  <DIV class=avatar style="WIDTH: 120px"><IMG height=120 alt="" 
                  src="scjp 的一些笔记.files/4334_2007441013970215.jpg" width=120 
                  border=0></DIV></TD></TR></TBODY></TABLE><BR>UID 4334<BR>精华 0<BR>积分 
            888<BR>帖子 81<BR>阅读权限 30<BR>注册 2006-10-22<BR>状态 离线 </DIV></TD>
          <TD 
          style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px" 
          vAlign=top width="82%">
            <TABLE class=t_msg cellSpacing=0 cellPadding=5 border=0>
              <TBODY>
              <TR>
                <TD>
                  <DIV>
                  <DIV class="right t_number"><A class=bold title=复制帖子链接到剪贴板 
                  onclick="setcopy('http://www.spoto.net/bbs/viewthread.php?tid=12957&amp;page=1#pid71959', '已经复制到剪贴板')" 
                  href="http://www.spoto.net/bbs/viewthread.php?tid=12957&amp;page=1&amp;extra=page%3D1###">#3</A></DIV>
                  <DIV class=right style="PADDING-TOP: 5px"><A 
                  href="http://www.spoto.net/bbs/magic.php?action=user&amp;pid=71959" 
                  target=_blank>使用道具</A>&nbsp;&nbsp;</DIV>
                  <DIV style="PADDING-TOP: 5px">发表于 2007-5-15 20:31&nbsp; <A 
                  href="http://www.spoto.net/bbs/profile-uid-4334.html" 
                  target=_blank>资料</A>&nbsp; <A title=allen_su的个人空间 
                  href="http://www.spoto.net/bbs/space-uid-4334.html" 
                  target=_blank>个人空间</A>&nbsp; <A 
                  href="http://www.spoto.net/bbs/pm.php?action=send&amp;uid=4334" 
                  target=_blank>短消息</A>&nbsp; <A id=ajax_buddy_2 
                  onclick="ajaxmenu(event, this.id)" 
                  href="http://www.spoto.net/bbs/memcp.php?action=buddylist&amp;newbuddyid=4334&amp;buddysubmit=yes" 
                  target=_blank>加为好友</A>&nbsp; </DIV></DIV></TD></TR>
              <TR>
                <TD class=line style="PADDING-TOP: 10px" vAlign=top 
                height="100%">
                  <DIV style="FLOAT: right" align=right><A title="评分 0" 
                  href="http://www.spoto.net/bbs/misc.php?action=viewratings&amp;tid=12957&amp;pid=71959"></A></DIV><SPAN 
                  class=bold>回复 #2 allen_su 的帖子</SPAN><BR><BR>
                  <DIV class=t_msgfont id=message71959>Scjp 笔记<BR>1.<BR>Locale 
                  loc = Locale loc = Locale.getDefault();<BR>Date d = new Date() 
                  ;<BR>DateFormat df =DateFormat.getDateInstance();<BR>String 
                  date =df.format(d);<BR><BR>2<BR>注意静态倒入包的应用了<BR>import static 
                  com.sun.scjp.Geodetics. 
                  *;<BR>3.异常处理的情况:若在函数中没有直接处理,而执行finall语句,则在调用函数的时候可以处理也可以不处理。如/:<BR>public 
                  class TestEx<BR>{<BR>&nbsp; &nbsp; &nbsp; &nbsp; static void 
                  test()<BR>&nbsp; &nbsp; &nbsp; &nbsp; {<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  &nbsp; String x = null;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  System.out.print(x.toString() + " ");<BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } finally<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  &nbsp; System.out.print("finally ");<BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<BR>&nbsp; &nbsp; &nbsp; 
                  &nbsp; }<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp; public static void 
                  main(String[] args)<BR>&nbsp; &nbsp; &nbsp; &nbsp; {<BR>&nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<BR>&nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<BR>&nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  &nbsp; &nbsp; test();<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; } catch (Exception ex)<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<BR>&nbsp; &nbsp; 
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -