my assignment question is like that
Write a program which prints the letters in a char array in reverse order using
void printReverse(char
Man you code is right except some minor changes in the main method and in the loop and the method has to be static.
The signature printReverse(char[] letters, int size) means that when you call it, you have to pass char array and the size of the array
Try the following
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(letters,5);
}
public static void printReverse(char[] letters, int size){
for (int i = size-1; i >= 0 ; i--)
{
System.out.print(letters[i]);
}
}
}