October 2017
Beginner
318 pages
7h 26m
English
Our program has thrown an ArrayIndexOutOfBoundsException. This means that we tried to access memory that our memory array did not have access to. Specifically, we tried to look at what was at the index -1 of the array. Since arrays start at index 0, they don't have anything at index -1. Any piece of our computer's memory could be there, and for security reasons, programs aren't allowed to just go looking through a computer's memory because they want to. So, why did this happen? Why did we ask for index -1 of an array, which is never going to be a valid array index?
Well, our first if statement that implemented the functionality to clear our ArrayList executed just fine. Our program saw our CLEAR command, ...
Read now
Unlock full access