Java 二维数组的行数与列数

 当我们刷算法时,看到这个地方是有限制的。

我来解释一下这个限制

  • 0 <= matrix.length <= 100  //二维数组的行数
  • 0 <= matrix[i].length <= 100 //二维数组的列数
 1 //BB.java
 2 package com.wuroc.chapterten;
 3 
 4 /**
 5  * @author RocWu
 6  *
 7  */
 8 public class BB {
 9     int[][] array ={{1,2,3},{4,5,6}};
10     public static void main(String[] args) {
11         BB n = new BB();
12         System.out.println(n.array.length);//二维数组的行数
13         System.out.println(n.array[0].length);//二维数组的列数
14         }
15     
16 }
2
3
Output
n.array[0].length  【i】不可以大于行数,是第零行的意思。
如有错误,恳求读者指出,发送到wu13213786609@outlook.com。
原文地址:https://www.cnblogs.com/WLCYSYS/p/13737063.html