编程语言
首页 > 编程语言> > Java之StringCompare

Java之StringCompare

作者:互联网

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
    }
}

 

标签:Java,StringCompare,System,println,strB,strA,out,String
来源: https://www.cnblogs.com/0099-ymsml/p/15833526.html