解决方案 »

  1.   

    你这赋值的风格我就看不惯了
           newareacode=areacode;
            newnumber=number;
            newext=ext;
    ,这里应该弄反了吧
      

  2.   

    没有,他说的问题是这个 phonenumber.java:30: error: cannot find symbol
                                    invalid=true;
                                    ^
      symbol:   variable invalid
      location: class phonenumber
    1 error但是我记得这个可以的啊。然后我们运行完的结果应该是
    the number is: 800-4633339
    the number is: 800-4633339
    invalid phone number!  
    the number is: 0-0
    the number is: 800-1234567 ext 123
    the number is: 216-7654321
    mynumber and mynumber2 are different
    the number is: 0-0但是我做不出来invalid phone number!和 the number is: 800-1234567 ext 123不知道怎么搞了。求大神指导并告诉我如何改,如果有代码就更好了。
      

  3.   

    你这invalid变量也没定义呀,整个程序中它在哪里再次被使用
      

  4.   

    就是invalid那个不知道怎么搞。。所以在纠结中。。
      

  5.   

    我加多一个变量之后  
        private int areacode;
        private int number;
        private int ext;
        private boolean invalid;
    能够运行输出:
    the number is: 800-4633339
    the number is: 800-4633339
    the number is: 0-0
    the number is: 0-0
    the number is: 216-0
    mynumber and mynumber2 are different
    the number is: 0-0
      

  6.   

    确定没有问题。。不能加变量在上面。所以我就再纠结我把那个invalid去掉后也是运行出和你一样的。。我觉得我已经进入牛角尖里出不来了。
      

  7.   

    IDE的问题?如果是重启一下就搞定了