当前位置:网站首页>String对象(常量)池
String对象(常量)池
2022-06-25 22:00:00 【forwardMing】
对象池的主要目的是实现数据的共享处理,以String对象池为例,里面的内容就是为了重用,而重用实际上就属于共享设计。但是在java中对象(常量)池可以分为两种。
静态常量池:在程序(*.class)在加载时会自动将此程序中保存的字符串、普通的常量、类和方法的信息等等,全部进行分配
String strA="www.baidu.com"; String strB="www"+"baidu"+"com"; System.out.println(strA==strB);//true该程序中所有的内容都是都是常量数据(字符串的常量都是匿名数据),所以在程加载时会处理好相应的连接;
运行时常量池:一个程序加载后,里面可能有一些变量
String info="baidu"; String strA="www.baidu.com"; String strB="www"+info+"com";//存储在运行时常量池 System.out.println(strA==strB);//false这是因为info是变量,变量的内容是可以修改的, 程序在加载的时候并不确定info是什么内容。因此在字符串连接的时候,并不认为StrB的结构就是所需的最终的结果。
边栏推荐
- Implementation of sequence table: static and dynamic
- 电路模块分析练习6(开关)
- Comp212 distributed protocol
- 统计字符串中不同回文子序列的个数
- [opencv450 samples] read the image path list and maintain the proportional display
- #23class介绍
- 软件测试面试一直挂,面试官总是说逻辑思维混乱,怎么办?
- Meta universe standard forum established
- Circuit module analysis exercise 5 (power supply)
- 1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
猜你喜欢

Pycharm student's qualification expires, prompting no suitable licenses associated with account solution

Unity的Ping类使用
Why is BeanUtils not recommended?

ES6 learning -- let

论文笔记: 多标签学习 MSWL

百度:2022年十大热度攀升专业出炉,第一名无悬念!

问题记录与思考

Unity的Ping類使用

What is Unified Extensible Firmware Interface (UEFI)?
![[untitled] open an item connection. If it cannot be displayed normally, Ping the IP address](/img/34/d3c146d5faa2728cb5eb8f3ee00200.png)
[untitled] open an item connection. If it cannot be displayed normally, Ping the IP address
随机推荐
1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
Exclusive or operator simple logic operation a^=b
Es6-- set
毕业旅行 | 伦敦5日游行程推荐
Day3 data types and operators summary and job
cookie、session、token
Ue4 Ue5 combine le plug - in de reconnaissance vocale de bureau pour la reconnaissance vocale
As a programmer, how can we learn, grow and progress happily? (personal perception has nothing to do with technology)
漏刻有时API接口实战开发系列(13):小鹅通云服务PHP-API二维数组传参解决方案
STM32开发板+机智云AIoT+家庭监测控制系统
Oracle - getting started
Circuit module analysis exercise 5 (power supply)
PDM fur
golang Make a list of intervals with sequential numbers
Flex & Bison 开始
LM small programmable controller software (based on CoDeSys) note XVII: PTO pulse function block
. SQL database import error: / *! 40101 SET @OLD_ COLLATION_ [email protected]@COLLATION_ CONNECTION */
Count the number of different palindrome subsequences in the string
Leetcode(435)——无重叠区间
Sword finger offer 46 Translate numbers to strings (DP)