﻿<?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-天行键-文章分类-JAVA文章</title><link>http://www.blogjava.net/bnlovebn/category/12156.html</link><description>《周易》曰：&lt;br&gt;
天行健，君子以自强不息(乾卦)&lt;br&gt;
地势坤，君子以厚德载物(坤卦)
</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 03:35:19 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 03:35:19 GMT</pubDate><ttl>60</ttl><item><title>在继承中的成员变量好像不会向下转型的</title><link>http://www.blogjava.net/bnlovebn/articles/52647.html</link><dc:creator>重归本垒（BNBN）</dc:creator><author>重归本垒（BNBN）</author><pubDate>Wed, 14 Jun 2006 01:42:00 GMT</pubDate><guid>http://www.blogjava.net/bnlovebn/articles/52647.html</guid><wfw:comment>http://www.blogjava.net/bnlovebn/comments/52647.html</wfw:comment><comments>http://www.blogjava.net/bnlovebn/articles/52647.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bnlovebn/comments/commentRss/52647.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bnlovebn/services/trackbacks/52647.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"> 1</span>
				<img id="Codehighlighter1_18_93_Open_Image" onclick="this.style.display='none'; Codehighlighter1_18_93_Open_Text.style.display='none'; Codehighlighter1_18_93_Closed_Image.style.display='inline'; Codehighlighter1_18_93_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_18_93_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_18_93_Closed_Text.style.display='none'; Codehighlighter1_18_93_Open_Image.style.display='inline'; Codehighlighter1_18_93_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				<span style="COLOR: #000000"></span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Component1</span>
				<span id="Codehighlighter1_18_93_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 src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_18_93_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080"> 2</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_47_89_Open_Image" onclick="this.style.display='none'; Codehighlighter1_47_89_Open_Text.style.display='none'; Codehighlighter1_47_89_Closed_Image.style.display='inline'; Codehighlighter1_47_89_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_47_89_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_47_89_Closed_Text.style.display='none'; Codehighlighter1_47_89_Open_Image.style.display='inline'; Codehighlighter1_47_89_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> Component1(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i)</span>
						<span id="Codehighlighter1_47_89_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_47_89_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080"> 3</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Component1</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080"> 4</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080"> 5</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080"> 6</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span>
				<span style="COLOR: #008080"> 7</span>
				<span style="COLOR: #000000">
						<img id="Codehighlighter1_116_191_Open_Image" onclick="this.style.display='none'; Codehighlighter1_116_191_Open_Text.style.display='none'; Codehighlighter1_116_191_Closed_Image.style.display='inline'; Codehighlighter1_116_191_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_116_191_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_116_191_Closed_Text.style.display='none'; Codehighlighter1_116_191_Open_Image.style.display='inline'; Codehighlighter1_116_191_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Component2</span>
				<span id="Codehighlighter1_116_191_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 src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_116_191_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080"> 8</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_145_187_Open_Image" onclick="this.style.display='none'; Codehighlighter1_145_187_Open_Text.style.display='none'; Codehighlighter1_145_187_Closed_Image.style.display='inline'; Codehighlighter1_145_187_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_145_187_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_145_187_Closed_Text.style.display='none'; Codehighlighter1_145_187_Open_Image.style.display='inline'; Codehighlighter1_145_187_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> Component2(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i)</span>
						<span id="Codehighlighter1_145_187_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_145_187_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080"> 9</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Compunent2</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080">10</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">11</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">12</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span>
				<span style="COLOR: #008080">13</span>
				<span style="COLOR: #000000">
						<img id="Codehighlighter1_214_289_Open_Image" onclick="this.style.display='none'; Codehighlighter1_214_289_Open_Text.style.display='none'; Codehighlighter1_214_289_Closed_Image.style.display='inline'; Codehighlighter1_214_289_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_214_289_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_214_289_Closed_Text.style.display='none'; Codehighlighter1_214_289_Open_Image.style.display='inline'; Codehighlighter1_214_289_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Component3</span>
				<span id="Codehighlighter1_214_289_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 src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_214_289_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080">14</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_243_285_Open_Image" onclick="this.style.display='none'; Codehighlighter1_243_285_Open_Text.style.display='none'; Codehighlighter1_243_285_Closed_Image.style.display='inline'; Codehighlighter1_243_285_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_243_285_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_243_285_Closed_Text.style.display='none'; Codehighlighter1_243_285_Open_Image.style.display='inline'; Codehighlighter1_243_285_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> Component3(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i)</span>
						<span id="Codehighlighter1_243_285_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_243_285_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">15</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Compunent3</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080">16</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">17</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">18</span>
				<span style="COLOR: #000000">
						<img 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_306_646_Open_Image" onclick="this.style.display='none'; Codehighlighter1_306_646_Open_Text.style.display='none'; Codehighlighter1_306_646_Closed_Image.style.display='inline'; Codehighlighter1_306_646_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_306_646_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_306_646_Closed_Text.style.display='none'; Codehighlighter1_306_646_Open_Image.style.display='inline'; Codehighlighter1_306_646_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Root</span>
				<span id="Codehighlighter1_306_646_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 src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_306_646_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080">20</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">private</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i;<br /></span>
						<span style="COLOR: #008080">21</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> Component1 com1</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> Component1(i);<br /></span>
						<span style="COLOR: #008080">22</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> Component2 com2</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> Component2(i);<br /></span>
						<span style="COLOR: #008080">23</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> Component3 com3</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> Component3(i);<br /></span>
						<span style="COLOR: #008080">24</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_461_545_Open_Image" onclick="this.style.display='none'; Codehighlighter1_461_545_Open_Text.style.display='none'; Codehighlighter1_461_545_Closed_Image.style.display='inline'; Codehighlighter1_461_545_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_461_545_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_461_545_Closed_Text.style.display='none'; Codehighlighter1_461_545_Open_Image.style.display='inline'; Codehighlighter1_461_545_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> Root(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i)</span>
						<span id="Codehighlighter1_461_545_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_461_545_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">25</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000">i;<br /></span>
								<span style="COLOR: #008080">26</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> System.out.println(com1); </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">(2)</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">27</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Root</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080">28</span>
								<span style="COLOR: #000000">
										<img 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 id="Codehighlighter1_574_590_Open_Image" onclick="this.style.display='none'; Codehighlighter1_574_590_Open_Text.style.display='none'; Codehighlighter1_574_590_Closed_Image.style.display='inline'; Codehighlighter1_574_590_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_574_590_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_574_590_Closed_Text.style.display='none'; Codehighlighter1_574_590_Open_Image.style.display='inline'; Codehighlighter1_574_590_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> String toString()</span>
						<span id="Codehighlighter1_574_590_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_574_590_Open_Text">
								<span style="COLOR: #000000">{ </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Root</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">;}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">30</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_614_642_Open_Image" onclick="this.style.display='none'; Codehighlighter1_614_642_Open_Text.style.display='none'; Codehighlighter1_614_642_Closed_Image.style.display='inline'; Codehighlighter1_614_642_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_614_642_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_614_642_Closed_Text.style.display='none'; Codehighlighter1_614_642_Open_Image.style.display='inline'; Codehighlighter1_614_642_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> print()</span>
						<span id="Codehighlighter1_614_642_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_614_642_Open_Text">
								<span style="COLOR: #000000">{System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Root</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">31</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">32</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span>
				<span style="COLOR: #008080">33</span>
				<span style="COLOR: #000000">
						<img id="Codehighlighter1_683_1308_Open_Image" onclick="this.style.display='none'; Codehighlighter1_683_1308_Open_Text.style.display='none'; Codehighlighter1_683_1308_Closed_Image.style.display='inline'; Codehighlighter1_683_1308_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_683_1308_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_683_1308_Closed_Text.style.display='none'; Codehighlighter1_683_1308_Open_Image.style.display='inline'; Codehighlighter1_683_1308_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Stem </span>
				<span style="COLOR: #0000ff">extends</span>
				<span style="COLOR: #000000"> Root</span>
				<span id="Codehighlighter1_683_1308_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 src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_683_1308_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080">34</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">private</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i;<br /></span>
						<span style="COLOR: #008080">35</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> Component1 com1</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> Component1(i);<br /></span>
						<span style="COLOR: #008080">36</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> Component2 com2</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> Component2(i);<br /></span>
						<span style="COLOR: #008080">37</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> Component3 com3</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> Component3(i);<br /></span>
						<span style="COLOR: #008080">38</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_838_935_Open_Image" onclick="this.style.display='none'; Codehighlighter1_838_935_Open_Text.style.display='none'; Codehighlighter1_838_935_Closed_Image.style.display='inline'; Codehighlighter1_838_935_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_838_935_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_838_935_Closed_Text.style.display='none'; Codehighlighter1_838_935_Open_Image.style.display='inline'; Codehighlighter1_838_935_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> Stem(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i)</span>
						<span id="Codehighlighter1_838_935_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_838_935_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">39</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
								<span style="COLOR: #0000ff">super</span>
								<span style="COLOR: #000000">(i);<br /></span>
								<span style="COLOR: #008080">40</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000">i;<br /></span>
								<span style="COLOR: #008080">41</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> System.out.println(com1); </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">(1)</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">42</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Stem</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /></span>
								<span style="COLOR: #008080">43</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">44</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_964_980_Open_Image" onclick="this.style.display='none'; Codehighlighter1_964_980_Open_Text.style.display='none'; Codehighlighter1_964_980_Closed_Image.style.display='inline'; Codehighlighter1_964_980_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_964_980_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_964_980_Closed_Text.style.display='none'; Codehighlighter1_964_980_Open_Image.style.display='inline'; Codehighlighter1_964_980_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> String toString()</span>
						<span id="Codehighlighter1_964_980_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_964_980_Open_Text">
								<span style="COLOR: #000000">{ </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Stem</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">;}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">45</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_1004_1032_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1004_1032_Open_Text.style.display='none'; Codehighlighter1_1004_1032_Closed_Image.style.display='inline'; Codehighlighter1_1004_1032_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_1004_1032_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1004_1032_Closed_Text.style.display='none'; Codehighlighter1_1004_1032_Open_Image.style.display='inline'; Codehighlighter1_1004_1032_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> print()</span>
						<span id="Codehighlighter1_1004_1032_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1004_1032_Open_Text">
								<span style="COLOR: #000000">{System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Stem</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">46</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_1075_1304_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1075_1304_Open_Text.style.display='none'; Codehighlighter1_1075_1304_Closed_Image.style.display='inline'; Codehighlighter1_1075_1304_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_1075_1304_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1075_1304_Closed_Text.style.display='none'; Codehighlighter1_1075_1304_Open_Image.style.display='inline'; Codehighlighter1_1075_1304_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">static</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> main(String[] args)</span>
						<span id="Codehighlighter1_1075_1304_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 src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1075_1304_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">47</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">Stem st=new Stem(10); </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">(1)</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">48</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> Root st</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> Stem(</span>
								<span style="COLOR: #000000">10</span>
								<span style="COLOR: #000000">); </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">(2)</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">49</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> System.out.println(st.com1);</span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">(1) 这里的com1是Stem中的Component1对象</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">50</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">(2) 这里的com1是Root中的Component1对象</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">51</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> <br /></span>
								<span style="COLOR: #008080">52</span>
								<span style="COLOR: #000000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> System.out.println(st);</span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">向下转型了</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">53</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> st.print();</span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">向下转型了</span>
								<span style="COLOR: #008000">
										<br />
								</span>
								<span style="COLOR: #008080">54</span>
								<span style="COLOR: #008000">
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />
								</span>
								<span style="COLOR: #000000"> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">55</span>
						<span style="COLOR: #000000">
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">56</span>
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>这里可以看出，就st对象的类型来取得相应类的成员变量！<br />好像只有在用到成员方法才会自动向下转型，而成员变量却不会！<img src ="http://www.blogjava.net/bnlovebn/aggbug/52647.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bnlovebn/" target="_blank">重归本垒（BNBN）</a> 2006-06-14 09:42 <a href="http://www.blogjava.net/bnlovebn/articles/52647.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个JProgressBar的简单例子</title><link>http://www.blogjava.net/bnlovebn/articles/40276.html</link><dc:creator>重归本垒（BNBN）</dc:creator><author>重归本垒（BNBN）</author><pubDate>Mon, 10 Apr 2006 09:25:00 GMT</pubDate><guid>http://www.blogjava.net/bnlovebn/articles/40276.html</guid><wfw:comment>http://www.blogjava.net/bnlovebn/comments/40276.html</wfw:comment><comments>http://www.blogjava.net/bnlovebn/articles/40276.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bnlovebn/comments/commentRss/40276.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bnlovebn/services/trackbacks/40276.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1																import								 javax.swing.								*								;								 2																																		import								 java.awt.								*								;								 3										...&nbsp;&nbsp;<a href='http://www.blogjava.net/bnlovebn/articles/40276.html'>阅读全文</a><img src ="http://www.blogjava.net/bnlovebn/aggbug/40276.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bnlovebn/" target="_blank">重归本垒（BNBN）</a> 2006-04-10 17:25 <a href="http://www.blogjava.net/bnlovebn/articles/40276.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>