问题及代码: package first; import java.util.Scanner; public class text { public static void main(String[] args) { System.out.println("请输入一个整数:"); Scanner get = new Scanner(System.in); int a = get.nextInt(); int sum = 0; while (a != 0) { int b = a % 10; sum = sum * 10 + b; a = a / 10; } System.out.println(+sum); } } 运行结果: