×

Loading...

各位JAVA高人,我碰到一个奇怪的问题,在一个CLASS里有一个PRIVATE FINAL 的STRING变量被一个PUBLIC STATIC的函数引用,(论理事不行的)

public class BooleanConvert {
。。。。
private final String trueString;
private final String falseString;
。。。。
public static BooleanConvert getZeroOneInstance() {
if (_zeroone == null) {
_zeroone = new BooleanConvert("1", "0") {
// the test looks for false, not true
public boolean toBoolean(String value) {
return (value != null) && !value.equals(this.falseString);

由于它被两个CLASS引用
在COMPILE 第一个CLASS时显示falseString非法,结果我加了this.falseString就可以了
在COMPILE第二个CLASS时显示this.falseString非法改为falseString就合法了。
奇怪吗?
Report