How to iterate over each element in a jagged array?

前端 未结 3 2092
温柔的废话
温柔的废话 2020-12-22 14:38

I have one 2 dimensional array, so an array of arrays. The arrays of the arrays DONT have the same lengths. Here an example:

double[][] multi = new double[][         


        
3条回答
  •  不知归路
    2020-12-22 15:01

    2D arrays are array of arrays... So one can iterate as:

       for (double[] row: multi) {
           for(double value: row) {
           }
       }
    

提交回复
热议问题