﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-Love Java,Love China!</title><link>http://www.blogjava.net/devliu1986/</link><description /><language>zh-cn</language><lastBuildDate>Thu, 07 May 2026 09:26:46 GMT</lastBuildDate><pubDate>Thu, 07 May 2026 09:26:46 GMT</pubDate><ttl>60</ttl><item><title>when upcasting .....</title><link>http://www.blogjava.net/devliu1986/archive/2008/05/25/202762.html</link><dc:creator>devliu</dc:creator><author>devliu</author><pubDate>Sun, 25 May 2008 11:40:00 GMT</pubDate><guid>http://www.blogjava.net/devliu1986/archive/2008/05/25/202762.html</guid><wfw:comment>http://www.blogjava.net/devliu1986/comments/202762.html</wfw:comment><comments>http://www.blogjava.net/devliu1986/archive/2008/05/25/202762.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/devliu1986/comments/commentRss/202762.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/devliu1986/services/trackbacks/202762.html</trackback:ping><description><![CDATA[<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><span style="color: #008080">&nbsp;1</span><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: #008000">//</span><span style="color: #008000">&nbsp;codes&nbsp;start</span><span style="color: #008000"><br />
</span><span style="color: #008080">&nbsp;2</span><span style="color: #008000"><img id="Codehighlighter1_25_279_Open_Image" onclick="this.style.display='none'; Codehighlighter1_25_279_Open_Text.style.display='none'; Codehighlighter1_25_279_Closed_Image.style.display='inline'; Codehighlighter1_25_279_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_25_279_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_25_279_Closed_Text.style.display='none'; Codehighlighter1_25_279_Open_Image.style.display='inline'; Codehighlighter1_25_279_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;base</span><span id="Codehighlighter1_25_279_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_25_279_Open_Text"><span style="color: #000000">{</span><span style="color: #008000">//</span><span style="color: #008000">a&nbsp;base&nbsp;class<br />
</span><span style="color: #008080">&nbsp;3</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">&nbsp;4</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;constructor</span><span style="color: #008000"><br />
</span><span style="color: #008080">&nbsp;5</span><span style="color: #008000"><img id="Codehighlighter1_70_116_Open_Image" onclick="this.style.display='none'; Codehighlighter1_70_116_Open_Text.style.display='none'; Codehighlighter1_70_116_Closed_Image.style.display='inline'; Codehighlighter1_70_116_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_70_116_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_70_116_Closed_Text.style.display='none'; Codehighlighter1_70_116_Open_Image.style.display='inline'; Codehighlighter1_70_116_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;base()</span><span id="Codehighlighter1_70_116_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_70_116_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">base&nbsp;class&nbsp;construct</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;perform</span><span style="color: #008000"><br />
</span><span style="color: #008080">&nbsp;9</span><span style="color: #008000"><img id="Codehighlighter1_150_194_Open_Image" onclick="this.style.display='none'; Codehighlighter1_150_194_Open_Text.style.display='none'; Codehighlighter1_150_194_Closed_Image.style.display='inline'; Codehighlighter1_150_194_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_150_194_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_150_194_Closed_Text.style.display='none'; Codehighlighter1_150_194_Open_Image.style.display='inline'; Codehighlighter1_150_194_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;perform()</span><span id="Codehighlighter1_150_194_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_150_194_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">10</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">base&nbsp;class&nbsp;perform</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">11</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">12</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;destructor</span><span style="color: #008000"><br />
</span><span style="color: #008080">13</span><span style="color: #008000"><img id="Codehighlighter1_232_277_Open_Image" onclick="this.style.display='none'; Codehighlighter1_232_277_Open_Text.style.display='none'; Codehighlighter1_232_277_Closed_Image.style.display='inline'; Codehighlighter1_232_277_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_232_277_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_232_277_Closed_Text.style.display='none'; Codehighlighter1_232_277_Open_Image.style.display='inline'; Codehighlighter1_232_277_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;finalize()</span><span id="Codehighlighter1_232_277_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_232_277_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">14</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">base&nbsp;class&nbsp;destruct</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">15</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">16</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">17</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br />
</span><span style="color: #008080">18</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br />
</span><span style="color: #008080">19</span><span style="color: #000000"><img id="Codehighlighter1_309_568_Open_Image" onclick="this.style.display='none'; Codehighlighter1_309_568_Open_Text.style.display='none'; Codehighlighter1_309_568_Closed_Image.style.display='inline'; Codehighlighter1_309_568_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_309_568_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_309_568_Closed_Text.style.display='none'; Codehighlighter1_309_568_Open_Image.style.display='inline'; Codehighlighter1_309_568_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;subbase&nbsp;</span><span style="color: #0000ff">extends</span><span style="color: #000000">&nbsp;base</span><span id="Codehighlighter1_309_568_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_309_568_Open_Text"><span style="color: #000000">{</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;derive&nbsp;from&nbsp;base<br />
</span><span style="color: #008080">20</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">21</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;constructor</span><span style="color: #008000"><br />
</span><span style="color: #008080">22</span><span style="color: #008000"><img id="Codehighlighter1_362_407_Open_Image" onclick="this.style.display='none'; Codehighlighter1_362_407_Open_Text.style.display='none'; Codehighlighter1_362_407_Closed_Image.style.display='inline'; Codehighlighter1_362_407_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_362_407_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_362_407_Closed_Text.style.display='none'; Codehighlighter1_362_407_Open_Image.style.display='inline'; Codehighlighter1_362_407_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;subbase()</span><span id="Codehighlighter1_362_407_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_362_407_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">23</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">sub&nbsp;class&nbsp;construct</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">24</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">25</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;perform</span><span style="color: #008000"><br />
</span><span style="color: #008080">26</span><span style="color: #008000"><img id="Codehighlighter1_441_484_Open_Image" onclick="this.style.display='none'; Codehighlighter1_441_484_Open_Text.style.display='none'; Codehighlighter1_441_484_Closed_Image.style.display='inline'; Codehighlighter1_441_484_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_441_484_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_441_484_Closed_Text.style.display='none'; Codehighlighter1_441_484_Open_Image.style.display='inline'; Codehighlighter1_441_484_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;perform()</span><span id="Codehighlighter1_441_484_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_441_484_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">27</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">sub&nbsp;class&nbsp;perform</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">28</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">29</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;destructor</span><span style="color: #008000"><br />
</span><span style="color: #008080">30</span><span style="color: #008000"><img id="Codehighlighter1_522_566_Open_Image" onclick="this.style.display='none'; Codehighlighter1_522_566_Open_Text.style.display='none'; Codehighlighter1_522_566_Closed_Image.style.display='inline'; Codehighlighter1_522_566_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_522_566_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_522_566_Closed_Text.style.display='none'; Codehighlighter1_522_566_Open_Image.style.display='inline'; Codehighlighter1_522_566_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;finalize()</span><span id="Codehighlighter1_522_566_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_522_566_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">31</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">sub&nbsp;class&nbsp;destruct</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">32</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">33</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">34</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br />
</span><span style="color: #008080">35</span><span style="color: #000000"><img id="Codehighlighter1_591_975_Open_Image" onclick="this.style.display='none'; Codehighlighter1_591_975_Open_Text.style.display='none'; Codehighlighter1_591_975_Closed_Image.style.display='inline'; Codehighlighter1_591_975_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_591_975_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_591_975_Closed_Text.style.display='none'; Codehighlighter1_591_975_Open_Image.style.display='inline'; Codehighlighter1_591_975_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;casting</span><span id="Codehighlighter1_591_975_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_591_975_Open_Text"><span style="color: #000000">{</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;test&nbsp;casting&nbsp;class<br />
</span><span style="color: #008080">36</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;constructor</span><span style="color: #008000"><br />
</span><span style="color: #008080">37</span><span style="color: #008000"><img id="Codehighlighter1_645_689_Open_Image" onclick="this.style.display='none'; Codehighlighter1_645_689_Open_Text.style.display='none'; Codehighlighter1_645_689_Closed_Image.style.display='inline'; Codehighlighter1_645_689_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_645_689_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_645_689_Closed_Text.style.display='none'; Codehighlighter1_645_689_Open_Image.style.display='inline'; Codehighlighter1_645_689_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;casting()</span><span id="Codehighlighter1_645_689_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_645_689_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">38</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">begin&nbsp;casting&nbsp;test</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
</span><span style="color: #008080">39</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">40</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">41</span><span style="color: #000000"><img id="Codehighlighter1_730_973_Open_Image" onclick="this.style.display='none'; Codehighlighter1_730_973_Open_Text.style.display='none'; Codehighlighter1_730_973_Closed_Image.style.display='inline'; Codehighlighter1_730_973_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_730_973_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_730_973_Closed_Text.style.display='none'; Codehighlighter1_730_973_Open_Image.style.display='inline'; Codehighlighter1_730_973_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;main(String&nbsp;args[])</span><span id="Codehighlighter1_730_973_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_730_973_Open_Text"><span style="color: #000000">{<br />
</span><span style="color: #008080">42</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />base&nbsp;father&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">new</span><span style="color: #000000">&nbsp;base();<br />
</span><span style="color: #008080">43</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />subbase&nbsp;son&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">new</span><span style="color: #000000">&nbsp;subbase();<br />
</span><span style="color: #008080">44</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">45</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />father.perform();<br />
</span><span style="color: #008080">46</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />son.perform();<br />
</span><span style="color: #008080">47</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">48</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />father&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;(base)son;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;&lt;1&gt;</span><span style="color: #008000"><br />
</span><span style="color: #008080">49</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">father.perform();<br />
</span><span style="color: #008080">50</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">51</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />son&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;(subbase)father;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;&lt;2&gt;</span><span style="color: #008000"><br />
</span><span style="color: #008080">52</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">son.perform();<br />
</span><span style="color: #008080">53</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
</span><span style="color: #008080">54</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />father&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;(base)((subbase)father);&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;&lt;3&gt;</span><span style="color: #008000"><br />
</span><span style="color: #008080">55</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">father.perform();<br />
</span><span style="color: #008080">56</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">57</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
</span><span style="color: #008080">58</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br />
</span><span style="color: #008080">59</span><span style="color: #000000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;codes&nbsp;end<br />
</span><span style="color: #008080">60</span><span style="color: #008000"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div>
Today ,when i go for a interview ,the project manager asked me this question !<br />
Acturally ,It's just relate to the&nbsp;knowledge of reference &amp;&amp;&nbsp; object ! <br />
Be carefull ,Nothing !
<img src ="http://www.blogjava.net/devliu1986/aggbug/202762.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/devliu1986/" target="_blank">devliu</a> 2008-05-25 19:40 <a href="http://www.blogjava.net/devliu1986/archive/2008/05/25/202762.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>