参考代码:
import java.util.*;
public class Demo {
public static void main(String[] args) {
double[] nums = new double[10];
Scanner input = new Scanner(System.in);
for (int i = 0; i < 10; i++) {
nums[i] = input.nextDouble();
}
for (int i = 9; i >= 0; i--) {
System.out.print(nums[i] + "\t");
}
System.out.println("");
}
}
后面循环输出不就可以了
public class TestScanner {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
List
for (int i = 0; i < 10; i++) {
System.out.println("请输入第" + (i + 1) + "个数:");
int j = scan.nextInt();
list.add(i, j);
}
scan.close();
for (int i = 9; i >= 0; i--) {
System.out.println(list.get(i));
}
}
}