import java.util.Scanner;
public class Demo6_Sverse {
/**
* 将字符串反转
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个字符串:");
String s = sc.nextLine();
StringBuffer sb = new StringBuffer(s);
sb.reverse();
System.out.println(sb);
}
} |
|