1 package day08; 2 3 import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput; 4 5 public class StringDemo04 { 6 public static void main(String[] args) { 7 String s1 = "ABC"; 8 String s2 = "abc"; 9 String s3 = "ABC"; 10 //equals:比较字符串内容,区分大小写 11 System.out.println(s1.equals(s2)); 12 System.out.println(s1.equals(s3)); 13 //equalsIgnoreCase:比较字符串内容,不区分大小写 14 System.out.println(s1.equalsIgnoreCase(s2)); 15 } 16 17 }
执行结果: