我的代码有问题 我想分配一个简单的枚举变量和eclipse给我一个错误“EMPTY无法解决或不是 字段“
这是我的代码 我有一个类似下面的枚举种子:
public enum Seed { // to save as "Seed.java"
EMPTY, CROSS, NOUGHT
}
我有一个单元格类,我想使用种子类:
public class Cell {
// Package access
Seed content; // content of this cell (Seed.EMPTY, Seed.CROSS, or Seed.NOUGHT)
int row, col; // row and column of this cell
/** Constructor to initialize this cell with the specified row and col */
public Cell(int row, int col) {
this.row = row;
this.col = col;
clear(); // clear content
}
/** Clear this cell's content to EMPTY */
public void clear() {
content = Seed.EMPTY;//**ERROR** EMPTY cannot be resolved or is not a field
}
}
出了什么问题?
答案 0 :(得分:2)
保存项目并构建它,错误将消失