equalsIgnoreCase()方法是用来比较两个字符串是否相等,不区分大小写。
使用方法如下:
String str1 = "Hello";String str2 = "hello";// 使用equalsIgnoreCase()方法比较两个字符串是否相等boolean isEqual = str1.equalsIgnoreCase(str2);System.out.println(isEqual); // 输出 true在上面的例子中,str1和str2的值分别为"Hello"和"hello",虽然两个字符串的大小写不同,但是使用equalsIgnoreCase()方法比较时,返回的结果为true,说明两个字符串相等。

