I'm trying to get this library book sorting program to work. If anyone can look over the code and explain to me why this is messing up, I would really appreciate it. I had this code working a few months ago but upon revisiting it, this error has appeared.
Asked
Active
Viewed 726 times
-3
-
You didn't post any code. Make sure to post it here as text. Also, have you looked up that error? It's quite common. – Carcigenicate Oct 02 '19 at 02:21
-
Check the length of the Array first. – Scary Wombat Oct 02 '19 at 02:22
1 Answers
0
Since Index 0
is out of bounds, your array seems to be empty (length = 0
). Thus accessing any element (even at position 0) is invalid.
If this error occurs while you try to fill the array, please note, that arrays have fixed length in java.

Islingre
- 2,030
- 6
- 18