exception: java.lang.ArrayIndexOutOfBoundsException
Having a little trouble. While testing my java program in Internet Explorer
5, I received the following error.
'exception: java.lang.ArrayIndexOutOfBoundsException'
This error appears in the bottom of the window just above the taskbar. The
applet will not load. This error is random and can be solved by saving the
project under a different name. However, this seems to be a little annoying.
Please help me to prevent this in the future. Thanks...Ryan
Re: exception: java.lang.ArrayIndexOutOfBoundsException
This error usually happens when the you're trying to read an array that
exceeds the maximum number of elements in it.
For example, if you have array A[] of 10 elements, the legal indexing should
be
A[0] <--- note that the index number starts from 0 for the first element
A[1]
A[2]
......
A[9] <--- note that the 10th element is is assigned with index number 9
Since you did not provide any codes, and you mentioned that it happens
randomly, I assume a few things.
1. Your program receives an unspecified number of input from the user
2. You store the input in an array
3. You tried to retrieve the stored input using loops
If the assumption above is correct, you may need to re-look at the counter
variable that you used in the loop.
Hope this helps.
--
Best Regards,
Wing Hoe
---------------------------------------------------------------
ICQ: 2213281
Email: winghoe@hotmail.com
www: http://pwp.maxis.net.my/winghoe
Job Seeking Status : Active
Target : MNC consulting companies
Availability : May 2001 (after degree course finish)
---------------------------------------------------------------
"Ryan" <sslspk@yahoo.com> wrote in message news:3a0b76ba$1@news.devx.com...
>
> Having a little trouble. While testing my java program in Internet
Explorer
> 5, I received the following error.
>
> 'exception: java.lang.ArrayIndexOutOfBoundsException'
>
> This error appears in the bottom of the window just above the taskbar. The
> applet will not load. This error is random and can be solved by saving the
> project under a different name. However, this seems to be a little
annoying.
> Please help me to prevent this in the future. Thanks...Ryan