/*自动装箱与拆箱*/
public class WrapperDemo1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Integer i = 3;
int x = i;
Float j = 78.9f;
float y = j;
}
}
public class WrapperDemo1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Integer i = 3;
int x = i;
Float j = 78.9f;
float y = j;
}
}

本文通过两个示例介绍了Java中自动装箱与拆箱的过程:将基本类型转换为包装类对象(装箱),以及相反过程(拆箱)。示例包括Integer与int、Float与float之间的相互转换。

1301

被折叠的 条评论
为什么被折叠?



