COE211 Lecture16
COE211 Lecture16
Multidimensional arrays
A two-dimensional array
is declared by specifying the size of each dimension
int[][] scores = new int[12][50];
An array element
is referenced using two index values
value = scores[3][6]
The array stored in one row
Can be specified using one index
Two-dimensional arrays:
example
Expression Type Description
table int[][] 2D array of integers, or
array of integer arrays
table[5] int[] array of integers
table[5][12] int integer
See TwoDArray.java
See SodaSurvey.java
Chapter overview
This chapter focuses on
Array declaration and use
Multidimensional arrays