Formatting the code a bit better might help:
Code:
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
if (array1[i][j] == 0) {
array1[i][j] = 1;
System.out.println("Reserving seat - non-smoking - row: " + (i + 1) + " column: " + (j + 1));
total_seats--;
i = rows;
j = columns;
reservednon++;
break;
}
}
}
Presumably you know what the code itself is supposed to do. That is, what it's for. You haven't actually told us, so I'm having to guess a bit here (we're not mind readers).
I'm assuming this bit of code is checking through a seating array looking for a spare seat to reserve. Once it's found a "seat" (that is a 0 in the array...by the way, use meaningful variable names..."array" is not meaningful) it sets that entry in the array to 1, so it won't reserve it again. And then it has to break out of the search for a spare seat. Now, this code is not using a standard way of exiting a loop (I wouldn't have used a for loop for this myself in any case, but hey ho), at least not in my opinion.
So..how do you think it is ensuring it will exit the loops once it has found a seat?