class Break_Label_Demo {
public static void main(String[] args) {
int[][] arrayOfInts = { { 35, 77, 3, 589 },
{ 32, 1086, 1000, 7 },
{ 682, 147, 97, 975 }
};
int searchfor = 12;
int i;
int j = 0;
boolean foundIt = false;
search:
for (i = 0; i < arrayOfInts.length; i++) {
for (j = 0; j < arrayOfInts[i].length; j++) {
if (arrayOfInts[i][j] == searchfor) {
foundIt = true;
break search;
}
}
}
if (foundIt) {
System.out.println("Found " + searchfor +
" at " + i + ", " + j);
} else {
System.out.println(searchfor
+ " not in the array list");
}
}
}
Bookmarks