logo Practice-It logo


Language/Type: Java arrays
Author: Marty Stepp (on 2010/12/28)

Write a method named reverse that accepts an array of integers as its parameter and reverses the order of the elements of the array. You may assume that the array passed is not null.

For example, if the following arrays are passed:

int[] a1 = {11, 42, -5, 27, 0, 89};
int[] a2 = {10, 20, 30, 40, 50};

After the call, the arrays should store the following elements:

a1: {89, 0, 27, -5, 42, 11}
a2: {50, 40, 30, 20, 10}
Type your solution here:

This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.