public class StringTest{ protected StringTest(){ } public static void main ( String[] args ){ String s = "Call me Accp."; System.out.println( s + "的长度为:" + s.length()); System.out.println("字符串的第一个字符为:" + s.charAt(0)); System.out.println("字符串的最后一个字符为:" + s.charAt(s.length()-1)); System.out.println("字符串的C第一次出现的位置为:" + s.indexOf('c')); System.out.println("字符串的的子串:" + s.substring(2)); } } ---------------------------------- Call me Accp.的长度为:13 字符串的第一个字符为:C 字符串的最后一个字符为:. 字符串的C第一次出现的位置为:9 字符串的的子串:ll me Accp.