import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class trans {
/**examda
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
System.out.println("input string:");
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
System.out.println(new StringBuffer(buf.readLine()).reverse().toString());
}
}
前段时间去面试有道题目要写一个字符反转的方法,这个才是最强的字符反转的实现。
责任编辑:小草