| Author |
ArrayIndex OutOfBoundsException?
|
Ellen Zhao
Ranch Hand
Joined: Sep 17, 2002
Posts: 581
|
|
Here is a class that solves linear equation system with LU-decomposition algorithmus. I got the error message when ran it: Please enter an integer as the size of the matrix: 5 java.lang.ArrayIndex OutOfBoundsException: 5 at NB2A71.main(NB2A71.java:31) Press any key to continue... The source code is as following: In this program, the initial values of a[i][j] and b[i] are specified here: How should I modify the code so that it can run? Thank you very much in advance!
|
 |
Michael Ernest
High Plains Drifter
Sheriff
Joined: Oct 25, 2000
Posts: 7292
|
|
|
Arrays start at zero, so that valid index range of your arrays will be 0 through 4. Modify the loop so that 5 cannot be a counter value.
|
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
|
 |
 |
|
|
subject: ArrayIndex OutOfBoundsException?
|
|
|