2-13 编程练习
public class HelloWorld {
public static void main(String[] args) {
// 定义int类型变量,值为100
int score = 100;
// 创建Integer包装类对象,表示变量score1的值
Integer score1 = new Integer(100);
// 将Integer包装类转换为double类型
double scoreD = score1.doubleValue();
// 将Integer包装类转换为long类型
long scoreL = score1.longValue();
// 将Integer包装类转换为int类型
int i = score1.intValue();
//打印输出
System.out.println("score对应的Integer类型结果为:"+score1);
System.out.println("score对应的double类型结果为:"+scoreD);
System.out.println("score对应的long类型结果为:"+scoreL);
System.out.println("重新由Integer转为int类型的结果为:"+i);
}
}80
收起
正在回答
1回答
同学你好,已完成练习,棒棒哒!继续加油!祝学习愉快!
java工程师2020版
- 参与学习 人
- 提交作业 9410 份
- 解答问题 16556 个
综合就业常年第一,编程排行常年霸榜,无需脱产即可学习,北上广深月薪过万 无论你是未就业的学生还是想转行的在职人员,不需要基础,只要你有梦想,想高薪
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星