File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Help with an array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with an array" Watch "Help with an array" New topic
Author

Help with an array

Brent Lancelot
Greenhorn

Joined: Apr 01, 2006
Posts: 8
hi i need some help with an array it says Hit uncaught exception java.lang.ArrayIndexOutOfBoundsException but im sure the index is ok

package Chapter5;



the second for loop is for organizing them


EDIT by mw: Added Code Tags to original poster's indentation.
[ April 01, 2006: Message edited by: marc weber ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

The second nested array (hours[1]) only has 6 elements...

int [][] hours = { {2,4,3,4,5,8,8}, {7,3,4,3,4,4}, ...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
Hey sir U r doing mistake to index of array. Like U have decleared 6 elements in second row of hours array. Count correctly isn't it. so y (in the inner loop) maximum should be up to 5. But U have set y as 6 that's why it is throwing such exception. Eithe change y up to 5 or increse 1 element in second row of hours array.
 
GeeCON Prague 2014
 
subject: Help with an array