If you declare an array to have 'n' elements the valid index values are:
0, 1, 2, 3 ... n-3, n-2, n-1 (count them all for reasonable values of 'n').
That's why; Java always starts its indexing at element number zero,
kind regards,
Jos
correct - as a mater of fact the majority of programing languages start with zero on arrays
what throws me off is for example:
pascal theArray[1..10,1..5] wil give me a 10 x 5 array
basic theArray(10,5) same - 10 x 5 array
is what your saying is that the following:
theArray[10][5]
will NOT give me a 10x5 array (excluding the fact that it really is since your starting at zero) to the extent that I cannot reach the max theArray[10][5]= n ?
bear in mind that the above two examples (pascal and basic) you can STILL use [0,0] (pascal) and (0,0)(basic) to use as data.
in conclusion - so I understand java arrays - in order to achieve a 10 x 5 array (in this example) and reach those numbers (i.e. theArray[10][5] = n) it actually needs to read theArray[11][6]?
(or I suppose I could n-- for the count.
as an after thought, kinda defeats the purpose of making a chessboard[8][8] and only have access to 0 - 7 even though your looking at the number "8" in the dimension. lol