代码如下:
import java.io.*;
import java.util.Scanner;
public class TestReverse{
public static void main(String args[]){
try{
Scanner input=new Scanner(System.in);
System.out.println("输入:");
String str=input.next();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
str=br.readLine();
char ch[]=new char[str.length()];
ch=str.toCharArray();
for(int i=ch.length-1;i>=0;i--){
System.out.print(ch[i]);
}
}catch(IOException e){}
}