9.List<Student> student(name,age) 比较oldList<Student>和newList<student>,按名字比较,获得新增的、修改的、删除学生列表;
public class TestKnowleage5 {
public static void main(String[] args){
System.out.println(reverse("abc"));
System.out.println(reverse2("abc"));
System.out.println(reverse3("abc"));
}
public static String reverse(String str){
return new StringBuffer(str).reverse().toString();
}
public static String reverse2(String str){
char[] chs = str.toCharArray();
char[] re = new char[chs.length];
for(int i = 0 ; i<chs.length;i++){
re[i] = chs[chs.length - i - 1];
}
return new String(re);
}
public static String reverse3(String str){
char[] chs = str.toCharArray();
String re = "";
for(int i = 0;i<chs.length;i++){
re += chs[chs.length - 1 -i];
}
return re;
}
}