Array Index Out of Bounds Exception - Java Programme.



Array Index Out of Bounds Exception (Java) The program's purpose is to ask the user for a string, and then count the number of times each character is used in the string.

let`s have a look at Programme. Programme : Output :
C++
Java
Perl
Python
java.lang.ArrayIndexOutOfBoundsException: 5


If we carefully observe the exception we will see that in line 10 of our code, we ask the [5] element. However, this element does not exist, as our matrix has size 5 and thus, a valid index resides in the interval [0, 4].

If you want the full Code of this programme let me know in the Comment box... or if any query... Thankyou...

Follow me on:

Comments