package Demo_1_22_String; public class StringCompare { public static void main(String[] args) { String strA = "a"; String strB = "A"; System.out.println(strA.equals(strB)); //false 区分大小写 System.out.println(strA.equalsIgnoreCase(strB)); //true 不区分大小写 System.out.println(strA.compareTo(strB)); //32 编码表中数值相减 strA - strB } }