您可以使用for循环或增强的for循环进行迭代:
for (int row=0; row < grid.length; row++){ for (int col=0; col < grid[row].length; col++) { int value = grid[row][col]; // Do stuff }}要么
// Note the different use of "row" as a variable name! This// is the *whole* row, not the row *number*.for (int[] row : grid){ for (int value : row) { // Do stuff }}第一个版本将是“查找坐标”问题的最简单解决方案-只需检查内部循环中的值是否正确即可。


![Java int [] []数组-迭代并查找值 Java int [] []数组-迭代并查找值](http://www.mshxw.com/aiimages/31/507670.png)
