hw8 - You can run through the original array forwards or...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
HW #8 1. Continuing from InClass20 , program a reverse(int[] a) method that will return an int[] object that is the reverse of the integers in the array a . a. Use a local variable, say tempArray , to hold the new array. b. Do not forget to instantiate tempArray ; note that you need the length of the array as you instantiate this. c. You can use arithmetic on the index to reverse the order of the array.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: You can run through the original array forwards or backs as you plop the numbers into tempArray . Modify the testRun() so as to test this new method. Invoke the testRun() method for testing. After invoking, use the inspector to open up the object, and inspect the contents of the instance variable xReversed . Are its contents indeed in the reverse order of that of x ?...
View Full Document

Ask a homework question - tutors are online