intern在JDK1.6和1.7区别
时间: 2024-04-26 11:23:15 浏览: 105
在JDK1.6中,执行s.intern()操作时,如果常量池中没有与s相同值的字符串,则会重新创建一个字符串对象,并将其放入常量池中。这样的话,常量池中的字符串对象与原来的s对象并不相等。这就是JDK1.6和JDK1.7在使用intern()方法时的区别。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [图解JDK 1.6、1.7中String.intern()的区别](https://blog.csdn.net/mkfka/article/details/108047023)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* *3* [jdk1.6和jdk1.7字符串intern()区别](https://blog.csdn.net/m0_56863607/article/details/129045166)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文