Problem with my double subscript array Java Applet

Status
You're currently viewing only Paralis's posts. Click here to go back to viewing the entire thread.
Not open for further replies.

Paralis

Ars Scholae Palatinae
930
Looks to me like you've got the variables switched in your loop. You use person to refer to array.length, and then product to refer to array[0].length, but when filling the array, you invert it. Eventually, your program will try to write to array[0][4]; that's what's throwing the exception.

Keep in mind in your other methods that Java numbers array elements starting at zero, so that an array of 5 elements is numbered from 0 - 4, not 1 - 5.
 
Status
You're currently viewing only Paralis's posts. Click here to go back to viewing the entire thread.
Not open for further replies.