测试
char[] s1 = {'I',' ','l','o','v','e',' ','j','a','v','a'}//s1 = I love java String s2 = new String("ejb"); s2.getChars(0,3,s1,7);//s1 = I love ejba System.out.println(s1); 结果为: I love ejba
String s = "www.fkit.org";String ss = "it"; System.out.println("s.indexOf('r'):" + s.indexOf('r')); System.out.println("s.indexOf('r',2):" + s.indexOf('r',2)); System.out.println("s.indexOf(ss):" + s.indexOf(ss)); 结果为: s.indexOf('r'):10 s.indexOf('r',2):10 s.indexOf(ss):6