Just after this tutorial, I was wondering what would happen if I try to traverse a 2D array, say: int[][] arr = new int[3][2]; // Some codes to assign values to the arr
到了最右下角的元素,这时候要全部结束遍历。 往左下的过程中,一般是行在加,列在减,有三种情况停止左下: 到了第一列,不能在往左了; 到了最下边的行,不能再往下了; 到了最右下角的元素,这时候要全部结束遍历。 我们把这个过程用代码实现出来就可以了,用多个 if - else 来分支处理。 代码(Java): 代码...
Just after this tutorial, I was wondering what would happen if I try to traverse a 2D array, say: int[][] arr = new int[3][2]; // Some codes to assign values to the arr
Just after this tutorial, I was wondering what would happen if I try to traverse a 2D array, say: int[][] arr = new int[3][2]; // Some codes to assign values to the arr