Lines 11 and 14 call method outputArray
(lines 18–28) to output the elements of array1
and array2
, respectively. Method outputArray
’s parameter—int[][] array
—indicates that the method receives a two-dimensional array. The nested for
statement (lines 20–27) outputs the rows of a two-dimensional array. In the loop-continuation condition of the outer for
statement, the expression array.length
determines the number of rows in the array. In the inner for
statement, the expression array[row].length
determines the number of columns in the current row of the array. The inner for ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.