equals与equalsIgnoreCase
作者:互联网
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 }
执行结果:
标签:String,s1,System,equals,equalsIgnoreCase,out 来源: https://www.cnblogs.com/xxeleanor/p/14253609.html