[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>java每日一题
关于Float,下列说法错误的是()
**A、Float是一个类
B、Float在java.lang包中
C、Float a = 1.0是正确的赋值方法
D、Float a = new Float(1.0)是正确的赋值方法
**
*答案:c
详解:
本题考查对基本数据类型及包装类的理解,首先Float是一个类,是float类型对应的包装类,Float直接继承Number,间接继承Object,同时实现Serializable和Comparable两个接口,八个包装类都在java.lang包中,所以在使用的时候不需要import导包,因为Float是引用数据类型,所以可以通过new调用构造方法创建对象,float类型有三个构造方法,都是带参数的,一个float类型,一个是double类型,还有一个是String类型,以上内容如果理解就很容易做出正确的选择了,ABD三个选项的描述是正确的,只有C选项描述错误,在JDK5版本之后出现了自动拆箱的特性,所以float
a = 1.0
这种自动装箱的写发其实是可以的,但是由于1.0是常量,在常量区中默认存储以double类型(64bit)来进行存储,想要直接转化成float进而自动装箱是不可以的,需要在1.0后面添加F才可以,所以C选项赋值编译错误,本题选择C选项
*
每天进步一点点!!!