I need to use a static method that returns an string array from the another string array in reverse. So if the array in the formal parameters is equal to "hello","there" the return needs to be "olleh","ereht".
My idea was to use the charAt command but it doesn't seem to work with an array. I can not use a built in method to solve this problem in one step. I also don't know how to move on to the next element in the array. Here is my code.
Part of main method that sets up the original array:
String [] d = {"hey","hello"};
System.out.println(Arrays.toString(count(d)));
My method:
private static String [] count(String[] d)
{
String[] reverse = new String [d.length];
int l = d.length;
for(int i = l -1; i >= 0; i--)
{
reverse = reverse + d.charAt(i);
}
return reverse;
}