Colorful Day
Blue keywords,Green comment,Red breakpoint,my life is also colorful
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆分類
AJAX(9)
(rss)
chit chat(6)
(rss)
EJB and APP Server
(rss)
JAVA foundation(5)
(rss)
MVC Framework(3)
(rss)
ORM(3)
(rss)
Spring(1)
(rss)
隨筆檔案
2006年7月 (2)
2006年6月 (4)
2006年3月 (9)
2006年2月 (4)
2005年12月 (2)
2005年11月 (4)
2005年10月 (4)
最新隨筆
1.?拉拉
2.?RSS訂閱服務擴展
3.?從codes學java tiger之varargs
4.?從code學習java tiger之自動裝箱 拆箱
5.?從code學習java tiger 之 枚舉
6.?從codes學java tiger之范型
7.?[導入]lerdorf's no-framework PHP MVC framework
8.?[導入]Working Software over Comprehensive Documentation
9.?[導入]AJAX Auto-complete component
10.?[導入]variable's scope in Javascript
最新評論
1.?請教[未登錄]
在eclipse+dreamwaver 8編程時,文件在dreamwaver中可以顯示但在eclipse中沒有顯示,為什么??請多多指教??萬分感謝,我的郵箱是 lingqiaoxu@sina.com
--ling
2.?re: AJAX貼貼臉 入門篇
2546
--45
3.?re: Behaviour.js 真正的清潔了html?
評論內容較長,點擊標題查看
--拐拐龍底咚
從code學習java tiger之自動裝箱 拆箱
Posted on 2006-06-22 18:34
BlueO2
閱讀(404)
評論(0)
編輯
收藏
所屬分類:
JAVA foundation
public
?
class
?AutoBoxing?
{
????
????
/**?*/
/**
?Creates?a?new?instance?of?AutoBoxing?
*/
????
public
?AutoBoxing()?
{
????}
????
public
?
void
?boxingDemo()
{
????????
//
auto?boxing
????????Integer?i?
=
?
0
;
????????
float
?f?
=
?
1.66f
;
????????Float?F?
=
?f;
????????
//
auto?unboxing
????????Integer?I?
=
?
new
?Integer(
1
);
????????
int
?i2?
=
?I;
????????
//
null?value?test,?it?will?case?NullPointerException
????????Integer?I2?
=
?
null
;
????????
int
?i3?
=
?I2;
????}
????
public
?
void
?testOperator()
{
????????Integer?i?
=
?
1
;
????????
while
(
true
)
{
????????????i
++
;
????????????System.out.println(
"
Counter:
"
+
i);
????????????
if
(i
>
5
)?
break
;
????????}
????}
????
public
?
void
?testCompare()
{
????????
//
it's?equal?because?-127~127?are?immutable?objects
????????Integer?i?
=
?
1
;
????????Integer?i2?
=
?
1
;
????????
if
(i?
==
?i2)?System.out.println(
"
1:Equal
"
);
????????
else
?System.out.println(
"
1:Not?Equal
"
);
????????
//
it's?not?equal?because?j?and?j2?are?different?objects
????????Integer?j?
=
?
200
;
????????Integer?j2?
=
200
;
????????
if
(j?
==
?j2)?System.out.println(
"
200:Equal
"
);
????????
else
?System.out.println(
"
200:Not?Equal
"
);
????}
????
public
?
void
?testControl()
{
????????Boolean?flag?
=
?
true
;
????????Integer?i?
=
?
20
;
????????Integer?j?
=
?
30
;
????????
if
(flag)
{
????????????System.out.println(
"
Boolean?affects
"
);
????????}
????????
if
(i
<
j)
????????????System.out.println(
"
Integer?affects
"
);
????}
????
public
?
void
?testMethod(
double
?arg)
{
????????System.out.println(
"
public?void?testMethod(double?arg)?is?invoked
"
);
????}
????
public
?
void
?testMethod(Integer?arg)
{
????????System.out.println(
"
public?void?testMethod2(Integer?arg)?is?invoked
"
);
????}
????
public
?
static
?
void
?main(String?args[])
{
????????AutoBoxing?auto?
=
?
new
?AutoBoxing();
????????auto.testCompare();
????????auto.testOperator();
????????auto.testControl();
????????
int
?i?
=
?
1
;
????????
//
?public?void?testMethod(Integer?arg)?wouldn't?be?invoked
????????
//
because??public?void?testMethod(double?arg)?will?be?invoked?in?JDK1.4
????????
//
Java?tiger?consider?the?backward?capability
????????auto.testMethod(i);
????????auto.boxingDemo();
????}
????
}
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
從codes學java tiger之varargs
從code學習java tiger之自動裝箱 拆箱
從code學習java tiger 之 枚舉
從codes學java tiger之范型
斗膽給Thinking in JAVA挑錯
公告
Name:
David
Age:
23
blueoxygen_cn(at)msn.com
5245091
blueoxygen(at)Gmail.com
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
Blogger's
評論排行榜
1.?Behaviour.js 真正的清潔了html?(1)
2.?AJAX貼貼臉 入門篇 (1)
3.?[collection]struts download Action(1)
4.?理清一下路線,集中力量辦大事(0)
5.?集成了,崩潰了(0)
閱讀排行榜
1.?AJAX貼貼臉 入門篇 (1586)
2.?Hibernate mapping summarize(984)
3.?Behaviour.js 真正的清潔了html?(961)
4.?Javascript操作xml小小showcase:xml轉換為table(939)
5.?[導入]AJAX Auto-complete component(902)
posts - 29, comments - 3, trackbacks - 0, articles - 0
Copyright © BlueO2
主站蜘蛛池模板:
华容县
|
嘉荫县
|
定襄县
|
丹阳市
|
渭源县
|
寿宁县
|
柳江县
|
张家界市
|
老河口市
|
胶州市
|
北流市
|
简阳市
|
荔波县
|
黄平县
|
周宁县
|
白沙
|
增城市
|
肥乡县
|
双峰县
|
山西省
|
寿光市
|
甘孜县
|
本溪
|
杨浦区
|
马龙县
|
克拉玛依市
|
信宜市
|
五家渠市
|
武强县
|
泰来县
|
咸宁市
|
南江县
|
马山县
|
都匀市
|
湘潭县
|
临沂市
|
化德县
|
崇文区
|
同德县
|
雅江县
|
鹤岗市
|