I'm having this interesting ArrayIndexOutofBounds exception.
The code is this:
int m = 0;
while (scan.hasNextInt())
{
intArray[m++] = scan.NextInt();
}
I'm merely scanning a bunch of integers into an array, but I always get an ArrayIndexOutofBounds error. I thought my int m was already initialized to zero?
Thanks
int[] intArray = new int[inputString.length()];where inputString is a string i'm scanning for ints.System.out.println(inputString.length());just before you define the array?nextIntsinceNextIntwon't compile.