输入n个数,然后倒着输出来:

import java.util.*;
public class Main {
	static Scanner cin = new Scanner(System.in);
	static void dfs(int n) {
		if(n>0) {
			int x=cin.nextInt();
			dfs(n-1);
			System.out.print(x+" ");
		}
	}
	public static void main(String[] args){
		int n=cin.nextInt();
		dfs(n);
	}
/*输入n个数,然后倒着输出来
5
3 2 1 4 5
5 4 1 2 3 
*/
}