my assignment question is like that
Write a program which prints the letters in a char array in reverse order using
void printReverse(char letters[], int size);
For example, if the array contains {'c', 's', 'c', '2', '6', '1'} the output should be "162csc".
I tried, but I don't know what it means
void printReverse(char letters[], int size);
I did this but there's problem with calling the method "printReverse" into main method
import java.util.Arrays;
import java.util.Collections;
public class search {
public static void main(String[] args) {
char[] letters = {'e', 'v', 'o', 'l', '4'};
printReverse();
}
public void printReverse(char[] letters, int size){
for (int i = letters.length-1; i >= 0 ; i--){
System.out.print(letters[i]);
}
}
}
void printReverse(char letters[], int size)
is the signature of the function that you have to do. E.g.and call it from your main window with the parameters.
This is a class which reveres the character array using recursion.
public class ReverseString {