You can assign initial values to an array when in a manner very similar to one-dimensional arrays, but with an extra level of braces. The dimension sizes are computed by the compiler from the number of values. This would allocated a 3x3 board
int[][] board = new int[][] {{1,0,0},{0,1,0},{1,2,1}};
No comments:
Post a Comment