ITeye博客

检测一个字符串是否在jvm的常量池中

Luob. · 2018-12-18 17:34 · Java · 编程语言 · JVM · Markdown


public static boolean inPool(String s) {  
    String s2 = s.intern();  
    if (s2 == s)  
        return true;  
    return false;  

} 

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。