package com.javabase.p1;
public class TestAPI {
public static void main(String[] args) {
/**
* 基本类型的自动装箱 拆箱
*/
//自动装箱
Integer i = 1;
//上面的相当于下面的分配内存的代码
int value = 100;
Integer ijj = new Integer(value);
System.out.println(ijj);
Short sh = 30;
Long l = 16L;
Float f = 20f;
Double h = 20d;
//自动拆箱
int icont = i;
System.out.println(icont);
long lgg = l;
System.out.println(lgg);
float fgg = f;
System.out.println(f);
double dgg = h;
System.out.println(dgg);
}
}
java基本类型的自动装箱-拆箱
最新推荐文章于 2022-12-20 16:28:57 发布