string.intern()方法
时间: 2023-09-12 14:09:38 浏览: 127
String.intern()方法用于将字符串添加到Java字符串常量池中,并返回常量池中对应字符串的引用。当调用str.intern()方法时,JVM会在当前类的常量池中查找是否存在与str值相等的字符串。如果存在,则返回常量池中的引用;如果不存在,则在常量池中创建一个新的字符串,并返回该字符串在常量池中的引用。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [谈谈String.intern方法](https://blog.csdn.net/weixin_45671242/article/details/118525329)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [详解String的intern方法](https://blog.csdn.net/m0_59181747/article/details/121146280)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文