Alan Krueger schrieb:
>> I got it
>>
[quoted text clipped - 4 lines]
> Actually, I think you mean "index < myArray.length". If the index is
> greater than the length (or even equal to it), you will get an exception.
Be aware, that arrays in Java are zero-based.
A typical loop over an array looks like this:
String[] strings = new String[]{"string0", "string1", "string2"};
// zero-based:
// strings[0] ==> "string0"
// strings[1] ==> "string1"
// strings[2] ==> "string2"
// strings.length == 3
for (int i = 0; i < strings.length; i++) {
String current = strings[i];
// do something with it ...
System.out.println(i + ": " + current);
}
This way you will never get any ArrayIndexOutOfBoundsExceptions ...
Greetings Finomosec;
Roedy Green - 17 Feb 2006 05:12 GMT
>Be aware, that arrays in Java are zero-based.
in other words if you have an array of 10 elements ,they are numbered
0 to 9.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.