Title
int[][] anArray = new int[10][8];
for (int j = 0; j < 8; j++)
{
for (int k = 0; k < 10; k++)
{
anArray[j][k] = 5;
}
}
- The code segment causes an ArrayIndexOutOfBoundsException to be thrown. How many elements in anArray will be set to 5 before the exception is thrown?
- Correct Answer: 8
- Explanation: I just counted wrong...I included the last value in the column when in reality the function would have stopped there