求数组元素中的最大值

package com.c2;

//求数组元素中最大的值
public class Css {
    public static void main(String[] args) {
        int a[][] = { { 1, 3, 5, 2 }, { 9, 87, 65, 34 }, { 2, 13, 1 } };
        int max = a[0][0];
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                if (max < a[i][j]) {
                    max = a[i][i];
                }

            }

        }
        System.out.println(max);//永远记得这一条代码的输出,所放的位置,在for循环外面,否则会循环同一个答案多行,理解不够

    }
}

二维数组有待继续

原文地址:https://www.cnblogs.com/langlove/p/3391111.html