当前位置:网站首页>Long类型的相等判断
Long类型的相等判断
2022-07-03 09:02:00 【padDio】
今天做项目的时候一直跑不出想要的结果,最后才发现是一处判断语句出了问题。有两个Long类型的变量初始赋值都为10000,但用“==”来判断结果却是判断它们不相等。
Long中有⼀个静态的内部类LongCache,专门⽤于缓存-128⾄127之间的值,⼀共256个元素。如果值在[-128, 127]之间,会放在缓存⾥⾯,此时用“==”可以判断两个变量相等。⽽超过这个范围就要new⼀个新的对象,也就是说"=="不能判断对象是否相等。
后来改成equals()来判断,最终才运行成功。
边栏推荐
- Solve POM in idea Comment top line problem in XML file
- Uc/os self-study from 0
- 1922. Count Good Numbers
- IDEA 中使用 Hudi
- CATIA automation object architecture - detailed explanation of application objects (I) document/settingcontrollers
- Banner - Summary of closed group meeting
- [set theory] order relation (chain | anti chain | chain and anti chain example | chain and anti chain theorem | chain and anti chain inference | good order relation)
- 【点云处理之论文狂读经典版13】—— Adaptive Graph Convolutional Neural Networks
- Navicat, MySQL export Er graph, er graph
- Flink学习笔记(十)Flink容错机制
猜你喜欢

Introduction to the basic application and skills of QT

Spark structured stream writing Hudi practice

Windows安装Redis详细步骤
![[point cloud processing paper crazy reading frontier version 8] - pointview gcn: 3D shape classification with multi view point clouds](/img/ee/3286e76797a75c0f999c728fd2b555.png)
[point cloud processing paper crazy reading frontier version 8] - pointview gcn: 3D shape classification with multi view point clouds

Idea uses the MVN command to package and report an error, which is not available

Detailed steps of windows installation redis

Beego learning - Tencent cloud upload pictures

Principles of computer composition - cache, connection mapping, learning experience
![[point cloud processing paper crazy reading cutting-edge version 12] - adaptive graph revolution for point cloud analysis](/img/c6/5f723d9021cf684dcfb662ed3acaec.png)
[point cloud processing paper crazy reading cutting-edge version 12] - adaptive graph revolution for point cloud analysis

【点云处理之论文狂读前沿版11】—— Unsupervised Point Cloud Pre-training via Occlusion Completion
随机推荐
About the configuration of vs2008+rade CATIA v5r22
The idea of compiling VBA Encyclopedia
LeetCode每日一题(2090. K Radius Subarray Averages)
Spark 集群安装与部署
CATIA automation object architecture - detailed explanation of application objects (I) document/settingcontrollers
【点云处理之论文狂读前沿版11】—— Unsupervised Point Cloud Pre-training via Occlusion Completion
Build a solo blog from scratch
Digital management medium + low code, jnpf opens a new engine for enterprise digital transformation
Navicat, MySQL export Er graph, er graph
Just graduate student reading thesis
Common formulas of probability theory
Database execution error: SQL_ mode only_ full_ group_ by:
[graduation season | advanced technology Er] another graduation season, I change my career as soon as I graduate, from animal science to programmer. Programmers have something to say in 10 years
[point cloud processing paper crazy reading classic version 12] - foldingnet: point cloud auto encoder via deep grid deformation
npm install安装依赖包报错解决方法
LeetCode每日一题(2115. Find All Possible Recipes from Given Supplies)
Windows安装Redis详细步骤
CSDN markdown editor help document
How to check whether the disk is in guid format (GPT) or MBR format? Judge whether UEFI mode starts or legacy mode starts?
Integrated use of interlij idea and sonarqube