Java String.equals() versus == Java按字典顺序比较两个字符串 Java ==运算符 Java String.equals() versus == public class Sample { public static void main(String []args) { String s1 = "codingdict"; String s2 = "codingdict"; String s3 = new String ("Tutorials Point"); System.out.println(s1.equals(s2)); System.out.println(s2.equals(s3)); } } Java按字典顺序比较两个字符串 Java ==运算符