×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / 各位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就合法了。
    奇怪吗?
    • Could you post the hole Class?
    • I can not understand your code and statements. PLease describe them more logically.
      • I have not time to study the whole project. The constructor inside
        protected BooleanConvert(String t, String f) {
        trueString = t;
        falseString = f;
        }
      • I have figure out how to solve the conflict