I'm just getting started with recursion, but I was able to utilize it to construct a basic factorial program without any difficulty. I'm now attempting to construct a recursive function that writes an array in reverse order, but I'm not sure what I'm doing wrong. I'm following the advice in this article (//https). I'm not sure what I'm missing. Thank you very much.
import java.io.*;
public class Recursion {
public static void main(String[] args) throws IOException{
int myArray[] = {1,2,3,4,5,6,7,8,9,10};
}
public static void reverseDisplay(int[] ary, int position){
if(position > 0)
System.out.print(ary[position]);
reverseDisplay(ary, position - 1);
}
}