class Teat0 {
public static void main(String[] args) {
int [][] arr = {{6,2},{3,7},{4,5}};
int min = getMin(arr);
System.out.println(min);
}
public static int getMin(int[][] arr){
int min =arr[0][0];
for (int x = 0;x<arr.length ;x++ ) {
for (int y = 0;y<arr[x].length ;y++ ) {
//注意内层y的范围是arr[x].length
if (arr[x][y]<min) {
min = arr[x][y];
}
}
}
return min;
}
} |