当前位置:网站首页>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 .
边栏推荐
- Applets - view and logic
- jdbc常见异常及错误解决办法汇总
- 社招两年半10个公司28轮面试面经(含字节、拼多多、美团、滴滴......)
- Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
- B. Box Fitting-CodeCraft-21 and Codeforces Round #711 (Div. 2)
- 关于go协程超时退出控制条件与方式分析
- 库项目和App项目中清单文件的包名不要相同
- RK3568+鸿蒙工控板工业网关视频网关解决方案
- Multithreaded learning 2- call control
- 23class introduction
猜你喜欢

Why is the frame rate calculated by opencv wrong?

After xampp restarts, the MySQL service cannot be started.

指针强化与提高

Xampp重启后,MySQL服务就启动不了。

提取系统apk

CSDN添加页内跳转和页外指定段落跳转

How to use drawing comparison function in CAD

Live800 online customer service system: do business across time and space, starting from each interaction

Pointer strengthening and improvement

QComboBox下拉菜单中有分隔符Separator时的样式设置
随机推荐
cookie、session、token
Comp2913 database
What is Unified Extensible Firmware Interface (UEFI)?
Qt Utf8 与 Unicode 编码的互相转换, Unicode编码输出为格式为 &#xXXXX
Xampp重启后,MySQL服务就启动不了。
Recently prepared to translate foreign high-quality articles
Analysis on the control condition and mode of go cooperation overtime exit
leetcode_ 136_ A number that appears only once
go中全类型等值判断解析&综合汇总
Implementation of sequence table: static and dynamic
character string
My C language learning process
cookie、session、token
jdbc常见异常及错误解决办法汇总
My vscode
Idea shortcut
Hibernate entity class curd, transaction operation summary
golang Make a list of intervals with sequential numbers
[opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
解决TypeError: Unicode-objects must be encoded before hashing