The Artima Developer Community
Sponsored Link

Java Answers Forum
array index out of bounds

2 replies on 1 page. Most recent reply: Aug 31, 2003 7:49 PM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
pete worth

Posts: 2
Nickname: pete12345
Registered: Aug, 2003

array index out of bounds Posted: Aug 28, 2003 5:29 AM
Reply to this message Reply
Advertisement
this line in my code:

newState = identifier[index];

keeps giving an arrayindexoutofboundsexception during runtime but from debugging using system.out, i'm positive that the following things are true:

newState.length = 7
i = 0
identifier.length = 59049
index = 48625

any ideas why the compiler says this is out of bounds?

thanks.


pete worth

Posts: 2
Nickname: pete12345
Registered: Aug, 2003

Re: array index out of bounds Posted: Aug 28, 2003 7:34 AM
Reply to this message Reply
its ok, i've sorted it now, 'i' wasn't what i thought it was :/

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: array index out of bounds Posted: Aug 31, 2003 7:49 PM
Reply to this message Reply
int n = 4; // some int value
you have to say which array element of newState you want to set to identifier[index];

newState[n] = identifier[index];
where n must be less than the newState array size
and index must be less than the identifier array size

Flat View: This topic has 2 replies on 1 page
Topic: JMagick documentation??? Previous Topic   Next Topic Topic: problem with http authentication

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use