
600 CHAPTER 9 Multidimensional Arrays and the ArrayList Class
Figure 9.12
Output from Example
9.10
the initialization list. We also define a single-dimensional array of Strings,
candidates, which holds the candidates’ names (lines 16–18). Each name in
the candidates array corresponds to the column in the votes array that holds
that candidate’s votes.
On lines 20–21, we instantiate the Tal ly object tally, passing the two-dimen-
sional array votes to the Tal ly overloaded constructor. Notice that for the
argument, we use only the array name, votes, without brackets.
On line 24, we call the arrayTally method, assigning the return value to a
two-dimensional ...