Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Problem in array length Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem in array length" Watch "Problem in array length" New topic
Author

Problem in array length

Rohit chandra
Greenhorn

Joined: Jun 23, 2007
Posts: 15


I am getting exception as Array index out of bound:5 at Perocolate.main(Percolate.java:19)

Well i am not getting the drift at all. For loop seems al right to me. The length of array is 5 so the for is incremented 4 times to get the last digit.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Do you really want a semicolon at the end of this line?

(I don't want to start a Brace Argument, but this the main reason I don't like opening braces on their own lines. It makes errors like this more difficult to see.)
[ June 26, 2007: Message edited by: marc weber ]

"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
Rohit chandra
Greenhorn

Joined: Jun 23, 2007
Posts: 15
Oops.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in array length
 
Similar Threads
integer parameters
Passing Elements of an array
array question
Passing Array references
What happens if the argument you want to pass is an object instead of a primitive?