62,620
社区成员
发帖
与我相关
我的任务
分享
public static void main(String args[]) {
BufferedReader buf = null;
buf = new BufferedReader(new InputStreamReader(System.in));
String str = null;
System.out.print("请输入内容: ");
StringBuffer sb = new StringBuffer();
try {
str = buf.readLine();
sb.append(str);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("输入的内容为: " + str);
System.out.println("逆序后的内容为: " + sb.reverse());
}