Question:
When I am running my program I am getting this error. Need some advice on that.?
Maria
2012-01-08 23:38:48 UTC
When i compile the program it wont give me errors, but once i run it this one appears.


Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
Three answers:
Mico
2012-01-08 23:54:18 UTC
we'll need more information but i'm guessing you are trying to access a memory past the size of your array?



it usually occurs when you create, say, an array of 5 (int[5] sample_array;) and tried to access the 6th one (sample_array[6] will cause an array out of bounds exception).



Also take note that an int[5] will allow you to store 5 items from indices 0 to 4, so sample_array[5] will also cause an out of bounds exception.
?
2016-11-17 04:17:57 UTC
you ought to flow to My records or My computing device and good click on a software or document and press delete try this for each little thing you dont go with. I recommend doing this on My Docuumnets because of the fact on My computing device you will have some belongings you go with which you dont go with to do away with. in the adventure that your pc is working sluggish meaning you ought to lots junk on your records. as quickly as your comprehensive deleting flow to recyling bin then you somewhat can delete them for good. continuously be certain you have goood memory on the computing device. happy Computering!
Dozo
2012-01-08 23:52:36 UTC
Guess your array index is to high or negative.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...