当前位置:网站首页>String object (constant) pool
String object (constant) pool
2022-06-25 23:35:00 【forwardMing】
The main purpose of object pool is to realize data sharing and processing , With String Object pool as an example , The content is for reuse , Reuse actually belongs to shared design . But in java Middle target ( Constant ) There are two types of pools .
Static constant pool : In procedure (*.class) When loading, the string saved in this program will be automatically 、 Ordinary constants 、 Class and method information, etc , Allocate all
String strA="www.baidu.com"; String strB="www"+"baidu"+"com"; System.out.println(strA==strB);//trueEverything in this program is constant data ( String constants are all anonymous data ), Therefore, the corresponding connection will be handled when the program is loaded ;
Runtime constant pool : After a program is loaded , There may be some variables in it
String info="baidu"; String strA="www.baidu.com"; String strB="www"+info+"com";// Stored in the runtime constant pool System.out.println(strA==strB);//falseThis is because info It's a variable. , The contents of variables can be modified , The program is not sure when it is loaded info What is it . So when you connect strings , I don't think StrB The structure of is the desired end result .
边栏推荐
- 关于go协程超时退出控制条件与方式分析
- Technology blog site collection
- 做接口测试,这3种工具到底什么时候用?
- User interaction scanner usage Advanced Edition example
- [opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
- 头歌 第3关:使用线程锁(Lock)实现线程同步
- UE4 学习记录二 给角色添加骨架,皮肤,及运动动画
- Idea auto generator generates constructor get/set methods, etc
- Use and difference between ue4\ue5 blueprint node delay and retroggable delay
- C. Planar Reflections-CodeCraft-21 and Codeforces Round #711 (Div. 2)
猜你喜欢

leetcode_ 136_ A number that appears only once

漏刻有时API接口实战开发系列(13):小鹅通云服务PHP-API二维数组传参解决方案

UE4 学习记录二 给角色添加骨架,皮肤,及运动动画

RK3568+鸿蒙工控板工业网关视频网关解决方案

CAD中图纸比较功能怎么用

24class static member

Kotlin空指针Bug

28 rounds of interviews with 10 companies in two and a half years (including byte, pinduoduo, meituan, Didi...)

Konva series tutorial 2: drawing graphics

konva系列教程2:绘制图形
随机推荐
统计字符串中不同回文子序列的个数
UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别
毕业旅行 | 伦敦5日游行程推荐
Go语言逃逸分析全纪录
Leetcode (435) - no overlapping interval
树状类查询组件
go中全类型等值判断解析&综合汇总
Idea FAQ collection
【AXI】解读AXI协议乱序机制
C language (I)
C. Yet Another Card Deck-Educational Codeforces Round 107 (Rated for Div. 2)
Day3 data types and operators summary and job
B. Box Fitting-CodeCraft-21 and Codeforces Round #711 (Div. 2)
To solve the incompatibility between VM and device/credential guard, an effective solution for the whole network
Comp2913 database
Recently prepared to translate foreign high-quality articles
解决‘tuple‘ object has no attribute ‘lower‘
Episode 3: thread synchronization using thread lock
character string
Konva series tutorial 2: drawing graphics