GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaInterview/java/src/JavaBasic/StringTest.java at master · damaohongtu/JavaInterview Expand file tree/ Copy pathStringTest.javaMore file actions 21 lines (19 loc) · 708 Bytes / Copy pathStringTest.javaFile metadata and controls21 lines (19 loc) · 708 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 package JavaBasic; /** * @Author MaoTian * @Classname StringTest * @Description TODO * @Date 上午9:39 2019/8/15 * @Version 1.0 * @Created by mao<[email protected]> */ public class StringTest { public static void main(String args[]) { String s1 = new StringBuilder().append("String").append("Test").toString(); System.out.println(s1.intern() == s1); //当调用 intern 方法时,如果常量池中已经该字符串,则返回池中的字符串; // 否则将此字符串添加到常量池中,并返回字符串的引用。 String s2 = new StringBuilder().append("ja").append("va").toString(); System.out.println(s2.intern() == s2); } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |