Iterate through 2 dimensional array

前端 未结 5 1907
心在旅途
心在旅途 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 13:58

    Just change the indexes. i and j....in the loop, plus if you're dealing with Strings you have to use concat and initialize the variable to an empty Strong otherwise you'll get an exception.

    String string="";
    for (int i = 0; i

提交回复
热议问题