Labels

Monday, June 11, 2012

Does Java support multi dimensional arrays?

The Java programming language does not really support multi-dimensional arrays. Itdoes, however, support arrays of arrays. In Java, a two-dimensional array 'arr' is really anarray of one-dimensional arrays:int[][] arr = new int[4][6];The expression arr[i] selects the one-dimensional array; the expression arr[i][j] selects theelement from that array.The built-in multi-dimensional arrays suffer the same indignities that simple one-dimensional arrays do: Array indices in each dimension range from zero to, where lengthis the array length in the given dimension. There is no array assignment operator. Thenumber of dimensions and the size of each dimension is fixed once the array has beenallocated.

No comments:

Post a Comment