Results 1 to 3 of 3
  1. #1
    Bmorebob is offline Member
    Join Date
    Mar 2011
    Location
    Manassas, VA
    Posts
    14
    Rep Power
    0

    Default [SOLVED] 2d Array, Array out of bounds exception

    I'm getting an "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1" on line 33 and I can't figure out what the deal is...any ideas?
    Last edited by Bmorebob; 03-24-2011 at 09:34 PM.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    Because you defined your 2d array as only having a single element in the first dimension and you are trying to do things with a second element along that dimension. That first "1" in your declaration of c25k means it only has one element in that dimension (i.e. only c[0][x]), it does not denote the highest index. If you want a second element (i.e. c[i][x]), you need a 2 in that position of your declaration, of course.

  3. #3
    Bmorebob is offline Member
    Join Date
    Mar 2011
    Location
    Manassas, VA
    Posts
    14
    Rep Power
    0

Similar Threads

  1. Help Array Index out of bounds exception
    By star400040 in forum New To Java
    Replies: 2
    Last Post: 12-10-2010, 10:24 PM
  2. Array Index Out Of Bounds Exception
    By manowar689 in forum New To Java
    Replies: 3
    Last Post: 06-18-2010, 11:25 PM
  3. array Index out of Bounds exception== 0
    By Allgorythm in forum New To Java
    Replies: 6
    Last Post: 02-11-2010, 04:02 PM
  4. Array Index Out of Bounds Exception
    By kool001 in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 07:42 AM
  5. Array out of bounds exception 20.
    By dropt in forum New To Java
    Replies: 4
    Last Post: 09-21-2009, 10:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •