go to previous page   go to home page   go to next page


  1. Must each array contain the same number of elements?
    • No — the method will work for any length of array.
  2. Must each array be an array of int?
    • Yes — the parameter must refer to an array of int

Picture of the Action

Here is a picture that shows what the executing program looks like just after the first call to the findMax() method. It is the same as the previous picture, but now there are two arrays. The parameter x of the findMax() method refers to the first array, at this moment.

At this point in the execution the second array has been created, but has not been used. The reference variable ar2 refers to it.


How can the findMax() method be used with the second array?

(Write the Java expression that does this. It will be similar to the first use of findMax().)