题解 | #数字颠倒#
数字颠倒
http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
while(scanner.hasNext()){
//方法一:for循环从后往前遍历
String[] strs = scanner.nextLine().split("");
for(int i=strs.length-1;i>=0;i--){
System.out.print(strs[i]);
}
//方法二:利用StringBuffer缓冲中的reverse前后倒置的函数
// StringBuffer strBuffer = new StringBuffer(scanner.nextLine());
// System.out.print(strBuffer.reverse());
}
}
}