定义list,逆序接收输入的字符
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String num=sc.next();
char[] numArray=num.toCharArray();
List<Character> list=new ArrayList();
for(int i=numArray.length-1;i>=0;i--){
list.add(numArray[i]);
}
String newNum="";
for(char i:list){
newNum+=i;
}
System.out.print(newNum);
}
}
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String num=sc.next();
char[] numArray=num.toCharArray();
List<Character> list=new ArrayList();
for(int i=numArray.length-1;i>=0;i--){
list.add(numArray[i]);
}
String newNum="";
for(char i:list){
newNum+=i;
}
System.out.print(newNum);
}
}