August 2004
Intermediate to advanced
480 pages
9h 41m
English
Even if your array is filled with primitive ints, every array in Java is an object, and is treated as such. Arrays are objects. So there are a number of methods that you can put to work to get value out of them. It also means that you should comply with object assignment and equivalency tests, as well as state and local laws.
You can think of two-dimensional arrays as holding a row and column number, in that order. For example, take Table 14-1.
| 0 | 1 | 2 | |
|---|---|---|---|
| 0 | 78 | — | 46 |
| 1 | 92 | 78 | 92 |
| 2 | 98 | 81 | 66 |
| 3 | 71 | 56 | 89 |
| 4 | 55 | 43 | 45 |
This table represents a two-dimensional array that holds 5 rows and 3 columns. You would create such an array like this:
int[][] grades = new int[5][3];
The element at position [3][2] is 89. The element at position [0][0] ...
Read now
Unlock full access