java二维数组A.length和A[i].length的区别

    public static void main(String[] args) {
	//// write your code here
        int[][] A=new  int[][]{{1,2},{4,5},{7,8,10,11,12},{}};
        System.out.println(A.length);//4,表示数组的行数
        System.out.println(A[0].length);//2,表示对应行的长度
        System.out.println(A[1].length);//2
        System.out.println(A[2].length);//5
    }

猜你喜欢

转载自blog.csdn.net/q451792269/article/details/83997902