????????Java?е????????
???????????? ???????[ 2014/6/17 13:31:11 ] ????????Java ???????
???????????????????????????????????????????????????Integer??valueOf(int)???????????????????????????Integer??intValue??????
????????????????????Double??Character??????????????????????????????
??????????????仰??????????????????
??????????????????e??????valueOf??????????????????????????e?????? xxxValue???????????xxx??????????????????????
??????.??????????????
????????????????????????????????????????????????????????????????????????????????????????о??Щ???????????/?????й????????
????1.??????δ????????????????
public class Main {
public static void main(String[] args) {
Integer i1 = 100;
Integer i2 = 100;
Integer i3 = 200;
Integer i4 = 200;
System.out.println(i1==i2);
System.out.println(i3==i4);
}
}
|
?????????Щ?????????????false??????????????????????true????????????????????
????????????????????????????????i1??i2????????????????i3??i4???????????????????????????????????????δ?????Integer??valueOf?????????????
??????????IntegerCache?????????
????????2?δ????????????????valueOf????????Integer????????????????[-128??127]??????????IntegerCache.cache?????????????????????????????μ?Integer????
??????????????i1??i2??????100??????????cache??????????????????i1??i2????????????????i3??i4???????????????
????2.??????δ????????????????
public class Main {
public static void main(String[] args) {
Double i1 = 100.0;
Double i2 = 100.0;
Double i3 = 200.0;
Double i4 = 200.0;
System.out.println(i1==i2);
System.out.println(i3==i4);
}
}
|
????????е?????????????????????????????????????????????????????????????
????View Code
??????????????????????????Double???valueOf??????
?????????????????????Double???valueOf???????????Integer???valueOf?????????????????????????Χ?????????????????????????????????????
???????Integer??Short??Byte??Character??Long???????valueOf?????????????????
????Double??Float??valueOf?????????????????
????3.??????δ???????????????
public class Main {
public static void main(String[] args) {
Boolean i1 = false;
Boolean i2 = false;
Boolean i3 = true;
Boolean i4 = true;
System.out.println(i1==i2);
System.out.println(i3==i4);
}
}
|
?????????????
???????????????????????????????Boolean??????????????????????Boolean??valueOf?????????????
?????????е? TRUE ??FALSE???????????Boolean?ж?????2?????????????
???????????????????????????????????????true???
????4.??Integer i = new Integer(xxx)??Integer i =xxx;??????????????
????????????????????????????????????????????????????????????????????????
????1?????????????????????????????????????????
????2???????Ч????????????????????????????Ч????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11