老师代码有什么问题吗
来源:2-13 编程练习
好闹心内心
2022-07-08 11:13:29
public class HelloWorld { public static void main(String[] args) { // 定义int类型变量,值为100 int score = 100; // 创建Integer包装类对象,表示变量score1的值 Integer score1=score; // 将Integer包装类转换为double类型 double score2=score1.doubleValue(); // 将Integer包装类转换为long类型 long score3=score1.longValue(); // 将Integer包装类转换为int类型 int score4=score1.intValue(); //打印输出 System.out.println("Integer包装类score1="+score1); System.out.println("double类型score2="+score2); System.out.println("long类型score3="+score3); System.out.println("int类型score4="+score4); } }
1回答
同学你好,程序运行结果符合题目要求,逻辑结构清晰,同学棒棒哒!
祝学习愉快!
相似问题