/**
-
* Created with IntelliJ IDEA.
-
*
-
* @author:
-
* @company:
-
*
-
* Date: 2018/12/15
-
* Time: 上午 09:42
-
* To change this template use File | Settings | File Templates.
-
* Description:
-
*/
//jdk用的是1.8.0据说每个版本都不一样这就有点坑了
public class test {
public static void main(String[] args) {
String s1 = “abc”;
String s2 = “abcd”;
String s3 = “abcdfg”;
String s4 = “1bcdfg”;
String s5 = “cdfg”;
String s6= “我”;System.out.println( s2.compareTo(s1) ); // -1 (前面相等,s1长度小1) System.out.println( s1.compareTo(s3) ); // -3 (前面相等,s1长度小3) System.out.println( s1.compareTo(s4) ); // 48 ("a"的ASCII码是97,"1"的的