Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   What does this JAVA exception mean? (https://www.warriorforum.com/programming/169908-what-does-java-exception-mean.html)

chatab 22nd January 2010 06:38 AM

What does this JAVA exception mean?
 
Quote:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
at Screen.draw(Screen.java:32)
at Menu.main(Menu.java:105)
I have no idea what it means.

David McKee 22nd January 2010 08:36 AM

Re: What does this JAVA exception mean?
 
It means that the array used in your program was accessed at a location it does not have, for example, if the array was defined as being length 10, and you accessed the array at it's 11th location, then you would get that error because it does not have an 11th location:

String[] myArray = {"first", "second", "third"};
System.out.println(myArray[3]);

This would give you an error because the array is indexed starting at position '0'.

myArray[0] = "first";
myArray[1] = "second";
myArray[2] = "third";

I hope that helps.

-DTM

chatab 22nd January 2010 08:39 AM

Re: What does this JAVA exception mean?
 
oooh woow thanks for sharing .... let me check


All times are GMT -6. The time now is 08:13 AM.