我有一个像下面这样的枚举,但是 eclipse 说每个相反对的第一个定义中有错误。
public enum Baz{
yin(yang), //Cannot reference a field before it is defined
yang(yin),
good(evil), //Cannot reference a field before it is defined
evil(good);
public final Baz opposite;
Baz(Baz opposite){
this.opposite = opposite;
}
}
我想要完成的是能够用来Baz.something.opposite
获取. 有没有可能的解决方法?也许在这个例子中定义了一个空的占位符 for and before and ?Baz.something
yang
bad
yin
good