第1个回答 推荐于2016-09-16
亲测。。。。
public class Max
{
public static void main(String[] args)
{
int[][] array = {{3,5,6,4 },
{4,5,56,68 },
{45,56,98,65}};
int i=0,j=0;
int temp = array[0][0];
for(;i<3;i++)
for(j=0;j<4;j++)
{
if(array[i][i]>temp) temp = array[i][j];
}
System.out.println("Max :"+temp);
}
}本回答被提问者采纳
第2个回答 2008-11-03
int[][] a = {{3,5,6,4,},{4,5,56,68,},{45,56,98,65,},};
int r=0,c=0,max=Integer.MIN_VALUE;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++){
if(max<a[i][j]){
max=a[i][j];
r=i;
c=j;
}
}
}
System.out.println("行:"+(r+1)+" 列:"+(c+1)+" 有最大值:"+max);