Iterate through 2 dimensional array

前端 未结 5 1909
心在旅途
心在旅途 2020-12-10 13:30

I have a \"connect four board\" which I simulate with a 2d array (array[x][y] x=x coordinate, y = y coordinate). I have to use \"System.out.println\", so I have to iterate

5条回答
  •  时光说笑
    2020-12-10 14:09

    Consider it as an array of arrays and this will work for sure.

    int mat[][] = { {10, 20, 30, 40, 50, 60, 70, 80, 90},
                    {15, 25, 35, 45},
                    {27, 29, 37, 48},
                    {32, 33, 39, 50, 51, 89},
                  };
    
    
        for(int i=0; i

提交回复
热议问题