Java String intern() 方法示例. Java正则表达式搜索和替换 Java String indexOf() 方法示例. Java String intern() 方法示例. import java.io.*; public class Test { public static void main(String args[]) { String Str1 = new String("Welcome to codingdict.com"); String Str2 = new String("WELCOME TO SUTORIALSPOINT.COM"); System.out.print("Canonical representation:" ); System.out.println(Str1.intern()); System.out.print("Canonical representation:" ); System.out.println(Str2.intern()); } } Java正则表达式搜索和替换 Java String indexOf() 方法示例.