总结:今天我很失败,问了老师继承的问题还是没弄懂。因为,技术宅的能力,我好怕啊。太强了。
package com.da.ima2; public class yut {// 使用substring方法//去字符串的子串,取字符串的一部分、、、取得字符串索引为2以后的所有字符串 public static void main(String[] args) { String a = "TestField"; String m = a.substring(2); System.out.println(m); // 使用toString方法 // charAt()方法 String s = "abc"; char c = s.charAt(1);// /charAt()是按照。索引值获得字符串指定的字符 // 规定:字符串中的第一个字符索引值是0,,第一个字符索引值是1.以此类推。 System.out.println(c); // comparTo() String s2 = "abc"; String s3 = "uoi"; int value = s2.compareToIgnoreCase(s3);// 接收的类型是整型 System.out.println(value); // compareToIgnoreCase()//忽略字符大小写,进行比较 String as = "FfdG"; String d = "FfdG"; int xx = as.compareToIgnoreCase(d); System.out.println(xx); // /字符串的连接concat String fs = "fasdf"; String ds = "ouiodf"; String ad = fs.concat(ds);// 这里的接收类型是字符串型 System.out.println(ad); // 字符串连接方法 +"" String abc = "dfasdf" + "23452"; System.out.println(abc); // 字符串变化 int ld = 32342; String fw = ld + ""; System.out.println(fw); // StringBuffer String dsa = "fasdfa"; StringBuffer sd = new StringBuffer(dsa); System.out.println(sd.append("3423"));// append方法里面的是字符串。不是字符。 System.out.println(sd.reverse()); } }