在Java中,从键盘中输入任意个数以倒序输出
1个回答
展开全部
import java.util.*;
public class Adder {
public static void main(String[] args) {
Scanner san = new Scanner(System.in);
System.out.print("请输入任意长度的数字: ");
String line = san.next();
StringBuffer sb = new StringBuffer(line);
System.out.print("倒序的输出为: " + sb.reverse());
}
}
public class Adder {
public static void main(String[] args) {
Scanner san = new Scanner(System.in);
System.out.print("请输入任意长度的数字: ");
String line = san.next();
StringBuffer sb = new StringBuffer(line);
System.out.print("倒序的输出为: " + sb.reverse());
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询