|
Fill in the blank so that max is initialized to a value that is no larger than the maximum element of the array. A good answer might be:The beginning (index 0) element in an array will never be larger than the maximum element in an array. (It might be the maximum element of the array; but this is fine.) This way of initializing max assumes that there is at least one element in the array. If there is not, the java system will detect that the index "0" is out of bounds and throw an exception.max = array[0]; | |
Initializing Max
Here is the program so far.
It has initialized max to
the first element in the array.
The
It would be OK (and maybe preferable) to initialize index at 1. But the program as written works fine (as soon as you fill in the blank.) | |
QUESTION 9:Complete the program. Click Here after you have answered the question |