java包装类练习

选择题

  1. C
  2. C
  3. BC
  4. D
  5. C
  6. B
  7. A
  8. A

编程题

public class Test3 {
    public static void main(String[] args) {
	    int score=100;
        Integer score1=new Integer(score);
        double score2=score1;
        long score3=score1;
        int score4=score1;
        System.out.println(score2);
        System.out.println(score3);
        System.out.println(score4);
}
public class Test3 {
    public static void main(String[] args) {
        double a=12.5;
        String str1=a+"10";
        System.out.println("a 转换为String型后+10的结果为: "+str1);
        String str="2.8";
        double b=Double.parseDouble(str)+10;
        System.out.println("str 转换为double型后+10的结果为: "+b);
}
public class Test3 {
    public static void main(String[] args) {
        float f1=88.99f;
        String f1ToString=f1+"20";
        System.out.println("f1 转换为String型后+20的结果为: "+f1ToString);
        String str2="188.55";
        System.out.println("str2 转换为double型后+20的结果为: "+(Double.parseDouble(str2)+20));
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值