StringBuffer6
package cn.it;
import java.util.Scanner;
/*
* 把字符串反转
*/
public class StringBuffer6 {
public static void main(String[] args) {
// 键盘录入数据
Scanner sc = new Scanner(System.in);
System.out.println("请输入数据:");
String s = sc.nextLine();
StringBuffer6 s1=new StringBuffer6();
//s1.myReverse(s);
//System.out.println(s1.myReverse(s));
String ss=StringBuffer6.Reverse2(s);
System.out.println("SS:"+ss);
}
public static String Reverse2(String s){
return new StringBuffer(s).reverse().toString();
}
* 把字符串反转
*/
public class StringBuffer6 {
public static void main(String[] args) {
// 键盘录入数据
Scanner sc = new Scanner(System.in);
System.out.println("请输入数据:");
String s = sc.nextLine();
StringBuffer6 s1=new StringBuffer6();
//s1.myReverse(s);
//System.out.println(s1.myReverse(s));
String ss=StringBuffer6.Reverse2(s);
System.out.println("SS:"+ss);
}
public static String Reverse2(String s){
return new StringBuffer(s).reverse().toString();
}
/* public static String myReverse(String s) {
String result = "";
char[] chs = s.toCharArray();
for(int x=chs.length-1;x>=0;x--){
result+=chs[x];
}
return result;
}
*/
}
String result = "";
char[] chs = s.toCharArray();
for(int x=chs.length-1;x>=0;x--){
result+=chs[x];
}
return result;
}
*/
}