Home Segments Top Top Previous Next

523: Mainline

To use an array element as an instance method target, you write an expression containing the array name, a bracketed integer index, and the instance-method name and arguments. The following expression, for example, yields the value produced by the rating method when used on the Movie instance stored in the place indexed by the value assigned to the counter variable:

movies[counter].rating()