51,397
社区成员




public class FindMax {
public static void main(String[] args) {
int[][] arr = { { 70, 12, 20, 13, 16 }, { 30, 21, 13, 17, 18 },
{ 18, 12, 50, 75, 31 }, { 32, 33, 25, 24, 40 }, };
int max = 0;
int row = -1;
int col = -1;
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr[i].length;j++){
if(arr[i][j]>max){
max = arr[i][j];
row = i;
col = j;
}
}
}
System.out.println("最大元素是:"+max+" 位置是 i="+row+" j="+col);
}
}