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
阅读(190)
评论(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新闻:
·
Adobe高管称HTML5不会赶上Flash
·
世界10大最贵域名:sex.com1400万美元排第二
·
微软希望能有更多团队开发基于其服务的跨平台游戏
·
纽约时报:手机应用增长速度超越网站
·
2月份iPhone占美国移动互联网流量63%
专题:
Android
iPad
jQuery
Chrome OS
博客园首页
IT新闻
知识库
学英语
Java程序员招聘
标题
姓名
主页
验证码
*
内容(请不要发表任何与政治相关的内容)
Remember Me?
登录
[使用Ctrl+Enter键可以直接提交]
每天10分钟,轻松学英语
推荐职位:
·
飞信服务器端高级.NET开发工程师(新媒传信)
·
.NET飞信官网开发工程师(新媒传信)
·
.NET技术开发总监(广州衣酷)
·
ASP.NET资深工程师 (盛大网络)
·
.NET初级程序员 (北京安人)
·
.NET中级程序员 (北京安人)
·
中高级.NET工程师(沪江网)
·
前端开发工程师(沪江网)
博客园首页随笔:
·
Eclipse结合SVN进行版本控制在执行更新时遇到的问题
·
【hello,JavaScript】人工干预随机数中的概率and一些数组的小事
·
http:get/post区别
·
迷茫啊,方向啊什么的最讨厌了,迷茫只因心中生!
·
[MSDN]Visual Studio 2008每日提示 第1辑:#001-#010
知识库:
·
怎样确定这是一个创业的好机会?
·
程序员,不止干到35岁
·
微软面试100题 你能答对多少
·
再论Java未来之路
·
.NET试题总结二
网站导航:
博客园
IT新闻
个人主页
博客生活
IT博客网
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贴贴脸 入门篇 (1305)
2. Hibernate mapping summarize(638)
3. [导入]AJAX Auto-complete component(625)
4. Behaviour.js 真正的清洁了html?(517)
5. Javascript操作xml小小showcase:xml转换为table(514)
posts - 29, comments - 3, trackbacks - 0, articles - 0
Copyright © BlueO2