exception: java.lang.ArrayIndexOutOfBoundsException


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: exception: java.lang.ArrayIndexOutOfBoundsException

  1. #1
    Ryan Guest

    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

  2. #2
    Lim Wing Hoe Guest

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center