5.15 LAB: Reverse array
Complete reverse() method that returns a new character array containing all contents in the parameter reversed.
Ex: If the input array is:
then the returned array will be:
import java.util.*;public class LabProgram {// This method reverses contents of input argument arr.public static char[] reverse(char[] arr) { /* Type your code here. */}
public static void main(String[] args) {char [] ch = {'a','b','c'};System.out.println(reverse(ch)); // Should print cba}}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here