package com.initCause;
public class HelloWorld {
//题目中并没有要求何种方法,只要求完成拆箱装箱操作,所以可以自己改手动或者自动装箱拆箱
public static void main(String[] args) {
// 定义int类型变量,值为100
int score=100;
// 创建Integer包装类对象,表示变量score1的值。手动装箱
Integer score1=new Integer(score);
// 将Integer包装类转换为double类型。自动拆箱
double d1=score1;
// 将Integer包装类转换为long类型.通过xxxValue()方法实现手动拆箱
long l1=score1.longValue();
// 将Integer包装类转换为int类型.手动拆箱
int i1=score1.intValue();
System.out.println("score对应的Integer类型结果为:"+score1);
System.out.println("score对应的double类型结果为:"+d1);
System.out.println("score对应的long类型结果为:"+l1);
System.out.println("重新由Integer转换为int类型结果为:"+i1);
}
}