package lrx.nb.main;
public class Main {
public static void main(String[] args) {
Integer i1 =new Integer(123) ; //手动装箱
System.out.println(i1);
Integer i=123; //自动装箱 相当于Integer i =new Integer(123);
System.out.println(i);
int resValue1 = i.intValue(); //自动拆箱
System.out.println(resValue1);
float resValue2=i.floatValue(); //自动拆箱并转换类型
System.out.println(resValue2);
}
}
java中的包装类型
最新推荐文章于 2024-07-20 23:59:39 发布