Hi, I am beginner to Java. I wanted to create a method that will reverse elements of my array, but I keep getting error and I am not sure why.
I use Jeliot to see what are the problems, but everything there is fine except the return statement in my code. Could anyone help me to fix it?
public class ReverseMe {
public static String revio(String[] a){ int N = a.length; String[] reverse = new String[N]; for (int i = 0; i < N ; i++) { reverse[i] = a[N-i-1]; } return reverse[N]; } public static void main (String[] args) { String[] myArray = {"1", "2", "3"}; String arr = revio(myArray); System.out.println(arr); } }