1 | To use an array value, you give the name of the array and the position number within [ ], and use it like any other variable. |
2 | int numbers [ ] = new int [ 7 ] ; |
3 | numbers [0] = 5 ; |
4 | numbers [1] = numbers [0] + 2 ; |
5 | String labels [ ] = new String [ 64 ]; |
6 | labels [ 0 ] = "The first string label"; |
7 | g.drawString ( labels [ 0 ], 10, 20 ) ; |
8 | Create the array |
9 | Assign position 0 |
10 | Use position 0 |