I think I'm missing something quite rudimentary, but in the following code I get the error
The local variable array may not have been initialized
at the line where I test for its nullity:
int [] array;
outerloop:
for(int x = xMin;x <= xMax;x++){
for(int y = yMin;y <= yMax;y++){
if(condition(x,y)){
array = new int[2];
array[0] = x;
array[1] = y;
break outerloop;
}
}
}
if(array != null){
//do something
}
Why is this? Shouldn't the test just return false in the case that the variable is uninitialized? I've been away from Java for a little while but I didn't think I'd forgotten that much ....
Thanks in advance :)