中午休息时间太短,只能练一会,不过好在这也是学习的趣味所在!
up!
- /*
- String API 练习
- */
- public class StringDemo {
- public static void main(String[] args) {
-
- String s = "abcdefghijklmnopqrstuvwxyz";
- String t = new String("abcdefghijklmnopqrstuvwxyz");
- print("s长度 = \t" + s.length());
- print("第16个英文字母 = " + s.charAt(15));
- print("是否以nopqrstuvwxyz结尾: " + s.endsWith("nopqrstuvwxyz"));
- print("t == s: " + (t == s));
- print("t.equals: " + t.equals(s));
- }
-
- public static void print(Object obj) {
-
- System.out.println(obj);
- }
- }
复制代码 |
|