应该没毛病吧?
public class HelloWorld {
public static void main(String[] args) {
// 定义int类型变量,值为100
int score = 100;
// 创建Integer包装类对象,表示变量score1的值
Integer score1=score;
// 将Integer包装类转换为double类型
double a=score1.doubleValue();
// 将Integer包装类转换为Long类型
Long b=score1.longValue();
// 将Integer包装类转换为int类型
int c=score1.intValue();
//打印输出
System.out.println("score对应的Integer类型结果为:"+score1);
System.out.println("score对应的double类型结果为:"+a);
System.out.println("score对应的long类型结果为:"+b);
System.out.println("重新由Integer转换为int类型结果为:"+c);
}
}104
收起
正在回答
2回答
代码没有问题,继续努力,加油~~
Java零基础入门18
- 参与学习 人
- 提交作业 7317 份
- 解答问题 14452 个
想要入门学编程?多年一直活跃在编程语言排行版前列的Java是一个很好的选择。本路径将从Java基础语法、面向对象、常用工具类三部分,为你开启软件开发的大门!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星