Java String intern() 方法 Java String indexOf(String str, int fromIndex) Java String lastIndexOf() 方法 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 String indexOf(String str, int fromIndex) Java String lastIndexOf() 方法