当前位置:网站首页>面试:为什么整数包装类尽量用equals()来比较大小
面试:为什么整数包装类尽量用equals()来比较大小
2022-06-12 16:05:00 【眠秋雨】
Byte、Short、Integer、Long这4种类型缓存了[-128,127]的相应缓存数据。
public class Test {
public static void main(String[] args) {
Integer i1=100;
Integer i2=100;
System.out.println(i1==i2); // true
Integer i3=900;
Integer i4=900;
System.out.println(i3==i4); // false
}
}
第9行比较的其实是两对象的地址,注意这是一个坑。
边栏推荐
- < 山东大学软件学院项目实训 > 渲染引擎系统——基础渲染器(三)
- Remote control of other computers -- detailed tutorial
- Instructions de soumission des tâches télécharger les tâches sur le disque réseau
- Saga体系结构模式:微服务架构下跨服务事务的实现
- 借助SpotBugs将程序错误扼杀在摇篮中
- Applet: how to get the user's mobile number in the plug-in
- Introduction and download website of common data of GIS, remote sensing, hydrology and Geography (2), supplementary~
- Understanding of dart typedef
- 任务 输出密雪冰城主题曲 0612
- 华为设备配置CE双归属
猜你喜欢

Axure RP 9 for Mac(交互式产品原型设计工具)中文版
![[tool recommendation] personal local markdown knowledge map software](/img/a2/5607df183ab37f32ae3fcd984d228e.png)
[tool recommendation] personal local markdown knowledge map software

鼻孔插灯,智商上升,风靡硅谷,3万就成

Axure RP 9 for MAC (interactive product prototyping tool) Chinese version

Saga architecture pattern: implementation of cross service transactions under microservice architecture

Understanding of dart typedef

jupyter notebook新環境快捷方式

Scanpy(六)空间转录组数据的分析与可视化

小飞页升级变智能修复Bug更快速了

With a lamp inserted in the nostril, the IQ has risen and become popular in Silicon Valley. 30000 yuan is enough
随机推荐
Web UI automation test
Reprise de Google net
小程序:如何在插件中获取用户手机号
华为设备配置CE双归属
nohup 命令使用
Scanpy (VI) analysis and visualization of spatial transcriptome data
Job submission instructions upload jobs to network disk
Servlet knowledge explanation (2)
C regular expression
In 2020, the demand for strain sensors in China will reach 9.006 million, and the market scale will reach 2.292 billion yuan [figure]
The common hand, the original hand and the excellent hand from the sum of Fibonacci sequence
Solution to idea Chinese prism garbled code error -- console Chinese output prism garbled code
Method reference instance method reference
UE4 common type conversion
< 山东大学软件学院项目实训 > 渲染引擎系统——基础渲染器(三)
Unity get local video / download network video
2022.02.28 - SX11-05. The largest rectangle in the histogram
Multimix:从医学图像中进行的少量监督,可解释的多任务学习
Development status of China's pig breeding industry in 2021 and comparative analysis of key enterprises: 671million pigs were sold [figure]
超详细干货!Docker+PXC+Haproxy搭建高可用强一致性的MySQL集群