- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
The following grid shows the state a 2D arraay:
This grid is created with the following code: This grid is created with the following code:
這道題目考的是2D陣列,題目要求要'X'連成三格,由此可知要在grid[2][0]填入'X'
| O | O | |
| X | O | |
| X | X |
public class q137 {
public static void main(String[] args)
{
char[][]grid=new char[3][3];
grid[1][1]='X';
grid[0][0]='O';
grid[2][1]='X';
grid[0][1]='O';
grid[2][2]='X';
grid[1][2]='O';
}
}
Which line of code,when inserted in place of //line n1 ,adds an X into the grid so that the grid contains three conseutive X's?
這道題目考的是2D陣列,題目要求要'X'連成三格,由此可知要在grid[2][0]填入'X'
留言
張貼留言