天行健
《周易》曰:
天行健,君子以自強不息(乾卦)
地勢坤,君子以厚德載物(坤卦)
導航
BlogJava
首頁
新隨筆
聯系
聚合
管理
統計
隨筆 - 119
文章 - 4
評論 - 92
引用 - 0
公告
對家人好點,對朋友好點,對自己好點
bnlovebn@21cn.com
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(5)
給我留言
查看公開留言
查看私人留言
隨筆分類
AJAX(2)
(rss)
DataBase(18)
(rss)
Hibernate(6)
(rss)
JAVA (24)
(rss)
JS(11)
(rss)
JSP(18)
(rss)
linux(5)
(rss)
SOA(1)
(rss)
Spring(7)
(rss)
Struts(6)
(rss)
webserver(2)
(rss)
WML(1)
(rss)
其它(25)
(rss)
系統設計(5)
(rss)
隨筆檔案
2011年6月 (3)
2010年4月 (1)
2008年12月 (1)
2008年9月 (2)
2008年6月 (4)
2008年5月 (8)
2008年4月 (3)
2008年3月 (5)
2007年11月 (5)
2007年10月 (2)
2007年9月 (1)
2007年7月 (15)
2007年6月 (3)
2007年5月 (8)
2007年4月 (3)
2007年3月 (1)
2007年2月 (6)
2007年1月 (5)
2006年12月 (15)
2006年11月 (5)
2006年10月 (3)
2006年9月 (3)
2006年7月 (2)
2006年6月 (14)
2006年4月 (1)
文章分類
JAVA文章(3)
(rss)
JSP文章
(rss)
其它(1)
(rss)
技術文章
(rss)
文章檔案
2011年6月 (1)
2006年9月 (1)
2006年6月 (1)
2006年4月 (1)
搜索
最新評論
1.?re: 無法使用此產品的安裝源,請確認安裝源存在,并且您可以訪問它
兩種方法都用了,都不行呀
--龍
2.?re: 系統啟動時出現錯誤:應用程序-特定 權限設置未將 COM 服務器應用程序(CLSID 為 {BA126AD1-2166-11D1-B1D0-00805FC1270E})的 本地 激活 權限授予用戶 NT AUTHORITY\NETWORK SERVICE 的解決.
DCOM
--dacan
3.?re: 關于Myeclipse configuration center中software中的personal sites中添加的插件無法刪除的解決
刪除 add site history :
D:\Genuitec是安裝目錄
D:\Genuitec\Common\configuration\bookmark.properties
--g_man1990
4.?re: Cannot find bean under name org.apache.struts.taglib.html.BEAN[轉][未登錄]
多謝
--zw
5.?re: 解決JS頁面跳轉ie,firefox,opera不兼容問題[未登錄]
在opera還是不能跳轉
--vincent
閱讀排行榜
1.?Hibernate SQL方言 (hibernate.dialect)(49473)
2.?幾種js實現的動態多文件上傳(32313)
3.?java創建文件夾,文件;刪除文件夾,文件(30138)
4.?無法使用此產品的安裝源,請確認安裝源存在,并且您可以訪問它(30101)
5.?js截取字符串的方法(19760)
評論排行榜
1.?[linux]警告:檢測到時鐘錯誤。您的創建可能是不完整的。(13)
2.?無法使用此產品的安裝源,請確認安裝源存在,并且您可以訪問它(13)
3.?幾種js實現的動態多文件上傳(12)
4.?Cannot find bean under name org.apache.struts.taglib.html.BEAN[轉](7)
5.?在用MyEclipse發布應用,構建路徑的問題(7)
在繼承中的成員變量好像不會向下轉型的
?1
class
?Component1
{
?2
?
public
?Component1(
int
?i)
{
?3
?System.out.println(
"
Component1
"
);
?4
?}
?5
}
?6
?7
class
?Component2
{
?8
?
public
?Component2(
int
?i)
{
?9
?System.out.println(
"
Compunent2
"
);
10
?}
11
}
12
13
class
?Component3
{
14
?
public
?Component3(
int
?i)
{
15
?System.out.println(
"
Compunent3
"
);
16
?}
17
}
18
19
class
?Root
{
20
?
private
?
int
?i;
21
?Component1?com1
=
new
?Component1(i);
22
?Component2?com2
=
new
?Component2(i);
23
?Component3?com3
=
new
?Component3(i);
24
?
public
?Root(
int
?i)
{
25
?
this
.i
=
i;
26
?System.out.println(com1);?
//
(2)
27
?System.out.println(
"
Root
"
);
28
?}
29
?
public
?String?toString()
{?
return
?
"
Root
"
;}
30
?
public
?
void
?print()
{System.out.println(
"
Root
"
);}
31
}
32
33
public
?
class
?Stem?
extends
?Root
{
34
?
private
?
int
?i;
35
?Component1?com1
=
new
?Component1(i);
36
?Component2?com2
=
new
?Component2(i);
37
?Component3?com3
=
new
?Component3(i);
38
?
public
?Stem(
int
?i)
{
39
?
super
(i);
40
?
this
.i
=
i;
41
?System.out.println(com1);?
//
(1)
42
?System.out.println(
"
Stem
"
);
43
?}
44
?
public
?String?toString()
{?
return
?
"
Stem
"
;}
45
?
public
?
void
?print()
{System.out.println(
"
Stem
"
);}
46
?
public
?
static
?
void
?main(String[]?args)
{
47
?
//
Stem?st=new?Stem(10);?
//
(1)
48
?Root?st
=
new
?Stem(
10
);?
//
(2)
49
?System.out.println(st.com1);
//
(1)?這里的com1是Stem中的Component1對象
50
?
//
(2)?這里的com1是Root中的Component1對象
51
?
52
?System.out.println(st);
//
向下轉型了
53
?st.print();
//
向下轉型了
54
?}
55
}
56
這里可以看出,就st對象的類型來取得相應類的成員變量!
好像只有在用到成員方法才會自動向下轉型,而成員變量卻不會!
posted on 2006-06-14 09:42
重歸本壘(Bing)
閱讀(482)
評論(1)
編輯
收藏
所屬分類:
JAVA文章
Comments
#
re: 在繼承中的成員變量好像不會向下轉型的
JAVA在線答疑
推薦JAVA在線答疑網站
Posted @ 2011-03-27 11:49
回復
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
項目中成功的運用proxool連接池
在繼承中的成員變量好像不會向下轉型的
一個JProgressBar的簡單例子
Powered by:
BlogJava
Copyright © 重歸本壘(Bing)
51La
主站蜘蛛池模板:
阿鲁科尔沁旗
|
嘉祥县
|
阿克
|
闽清县
|
临沂市
|
丽水市
|
定远县
|
台湾省
|
常德市
|
曲麻莱县
|
淮北市
|
大姚县
|
富源县
|
台湾省
|
奇台县
|
宁武县
|
永安市
|
嘉荫县
|
尚志市
|
洛阳市
|
石首市
|
荆州市
|
南京市
|
延庆县
|
札达县
|
龙门县
|
庆云县
|
呼玛县
|
安岳县
|
孝昌县
|
克拉玛依市
|
石阡县
|
冀州市
|
徐水县
|
横峰县
|
建水县
|
股票
|
衢州市
|
平原县
|
陆丰市
|
布尔津县
|