2016-07-31 28 views

回答

0

是的,这是可能的,我这里是通过他们迭代

public static void main(String[] args) { 
     int[][] numbers = new int[][] { { 1, 2, 3 }, { 1, 2, 3, 4 }, { 1, 2, 3, 4, 5 } }; 
     for(int i = 0; i<numbers.length;i++) { 
      for(int j = 0; j < numbers[i].length; j++) { 
       System.out.print(numbers[i][j]); 
      } 
      System.out.println(""); 
     } 
    } 

输出:

123 
1234 
12345 
1

是的,你可以有不同的列数为每行。

data_type [][] array = new data_type[row][]

array[0] = new data_type[size1]

array[1] = new data_type[size2]

P.S:你为什么不尝试你的系统上,问这样的问题了。

P.P.S:这里我假设row >=2

相关问题