package how2j.mathAndstring;
public class TestNumberPractice {
public static void main(String[] args) {
// byte
byte b = 1;
Byte by = b;// 装箱
byte b2 = by;// 拆箱
System.out.println("byte");
System.out.println("封装类型:" + by + "\t" + "基本类型:" + b2);
// short
short s = 2;
Short sh = s;
short s2 = sh;
System.out.println("short");
System.out.println("封装类型:" + sh + "\t" + "基本类型:" + s2);
// float
float f = 3;
Float fl = f;
float f2 = fl;
System.out.println("float");
System.out.println("封装类型:" + fl + "\t" + "基本类型:" + f2);
// double
double d = 4;
Double dox = d;
double d2 = dox;
System.out.println("double");
System.out.println("封装类型:" + dox + "\t" + "基本类型:" + d2);
System.out.println("第二题================================");
System.out.println("byte和Integer之间能否进行自动拆箱和自动装箱?");
// 自动装箱测试
//byte bb=5;
//Integer inx=bb;//失败
int ii=6;
Byte byx=(byte)ii;
System.out.println(byx);
// 自动拆箱测试
//Integer ii2 = new Integer(0);
//byte bxx = ii2;//失败
Byte bxxx = new Byte((byte) 2);
int xx = bxxx;
System.out.println(xx);
System.out.println("第三题================================");
System.out.println(Byte.MAX_VALUE);
}
}