New Picture

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

operate.findMax( ar2 )

New Picture

Here a picture that shows the situation just after the second method call: operate.print( ar2 ); The parameter x of the method now refers to the second array.

By using parameters with methods you can use the same method with different data. This makes the method into a useful tool that can be used in many situations.

Note: In this picture, the arrow connected to ar2 and the arrow connected to x look quite different, although they point to the same object. However, when the program is running, the reference in x is identical to the reference in ar2. Both contain an identical reference to the array object.

QUESTION 9:

(Review Question:) The findMax(int[] x) method uses a parameter that refers to an object. Can parameters also be primitive types, like int?