Java Language -- More on Arrays
An array of length 128 is subscripted by integers from 0 to 127.
Subscripts are range checked in runtime and so vec[-1] and vec[128] will generate exceptions.
Array length can be extracted via the length instance variable, e.g.
- int len = vec.length will assign len = 128.
Arrays can have dynamic sizing (a fixed size determined at runtime)
- int sizeofarray = 67;
- int vec[] = new int[sizeofarray];
Multidimensional arrays are arrays of arrays
- char icon[][] = new char[16][16]
- These arrays can be "ragged":
- int graph[][] = new int[2][];
- graph[0][] = new int[4];
- graph[1][] = new int[7];