请老师检查

来源:2-13 编程练习

hahaman123

2022-03-28 01:41:19

public class HelloWorld {
    public static void main(String[] args) {
    	// 定义int类型变量,值为100
		int score = 100; 
		// 创建Integer包装类对象,表示变量score1的值
		 Integer score1=new Integer(score) ;    
		// 将Integer包装类转换为double类型
		   System.out.println("score对应的Integer的类型结果为"+score1);     
		// 将Integer包装类转换为long类型
		   System.out.println("score对应的Integer的类型结果为"+score1.doubleValue());
		   System.out.println("score对应的long的类型结果为"+score1.longValue());   
		// 将Integer包装类转换为int类型
		  System.out.println("重新由Integer的类型转换为int结果为"+score1.intValue());  
		//打印输出
		
	}
}

请老师检查

写回答

1回答

好帮手慕小尤

2022-03-28

同学你好,测试同学代码已完成练习,棒棒哒!继续加油!

祝学习愉快!

0

0 学习 · 9886 问题

查看课程