Answer:
By scanning through the elements of the array, updating a provisional maximum until the last element is reached.
Find Maximum Method
This is the same algorithm that was used in the previous chapter.
Now it will be implemented as a method.
Here is a partial definition of the ArrayOps class.
The ArrayOps class contains a method findMax() that
finds the maximum of an array.
The parameter list is of the method is: int[] x
- This declares a formal parameter
xwhich will be a reference to an array object. - The caller is expected to supply a reference to an array as an actual parameter.
- The method is written using the parameter
xto stand for the actual array it will work with.
The parameter x means
"whatever data is supplied when the method
starts to run."
This might be different data at different times.
QUESTION 3:
Fill in the blank so that the method is complete.