What does this JAVA exception mean?

by 2 replies
5
I have no idea what it means.
#programming #exception #java
  • 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
  • oooh woow thanks for sharing .... let me check

Next Topics on Trending Feed