Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void reverse(Object[] array) {
- Object[] arrayNew = new Object[array.length];
- for(int i = 0; i < arrayNew.length - 1; i++) {
- arrayNew[i] = array[array.length - i];
- }
- for(int i = 0; i < array.length; i++) {
- array[i] = arrayNew[i];
- }
- // Add code to reverse the order of the elements of the array
- // This method should work on any array that stores any type of object
- // (including but not limited to CreditAccount objects)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement