String类中的几个常用方法(comapraTo,valueOf,charAt)
charAt();获得字符。
String str = "helloWorld";
char a = str.charAt(2);
System.out.println(a); //l
compareTo();
String a = "abc";
String b = "abd";
String c = "abc";
System.out.println(a.compareTo(b));//-1
System.out.print.
原创
2020-06-04 16:28:39 ·
644 阅读 ·
0 评论