我下面的代码似乎没有编译,我似乎得到了 9 个不同的错误,请任何人都可以看看我的代码并发布可以使其正确运行的修改?谢谢
class MineFinderModel {
public static int MINE_SQUARE = 10;
public static int EMPTY_SQUARE = 0;
int num_of_cols;
int num_of_rows;
int[][]
the_minefield;
public MineFinderModel(int n_cols, int n_rows) {
num_of_rows = n_rows;
num_of_cols = n_cols;
the_minefield = new int[num_of_cols][num_of_rows];
}
public boolean addMine(int thisCol, int thisRow) {
if (thisCol >= n_cols || thisRow >= n_rows)
return false;
if (the_minefield[thisCol][thisRow] == MINE_SQUARE)
return false;
the_minefield[thisCol][thisRow] = MINE_SQUARE;
return true;
}
public int getValue(int thisCol, int thisRow) {
if (thisCol >= n_cols || thisRow >= n_rows)
return false;
return the_minefield[thisCol][thisRow];
}
public void addMinesToCorners() {
the_minefield[0][0] = MINE_SQUARE;
the_minefield[0][n_rows - 1] = MINE_SQUARE;
the_minefield[n_cols - 1][0] = MINE_SQUARE;
the_minefield[n_cols - 1][n_rows - 1] = MINE_SQUARE;
}
}