Two Dimensional Arrays
15. Null Rows
Answer:
Yes. If a row does not exists (and therefore
uneven[row]
isnull
) the following code will throw anException
:for ( int col=0; col < uneven[row].length; col++ )
Null Rows
Here is a somewhat improved version of the program that tests each row to see if it exists. If the row exists, its
However, the code does assume that
length
is used:
|
However, the code does assume that
uneven
is non-null
.Question 15:
(Thought Question: ) Are 3-dimensional arrays possible?