non-static method cannot be referenced from a static context

后端 未结 5 1782
無奈伤痛
無奈伤痛 2020-12-10 09:36

I would like to understand this once and for all.

With this please excuse the mass of code pasted below, but I do not want to leave out any details.

The only

5条回答
  •  佛祖请我去吃肉
    2020-12-10 10:08

    Real solution? Don't put so much stuff in the main() method. That's for noobs.

    Java's an object-oriented language. Put the logic inside methods associated with the GarageComm class. main() should do little more than instantiate an instance and call its methods.

    Change it like this:

                GarageComm gc = new GarageComm();
                hashPos= gc.readPositions("holdingsBU.txt");//the error is here
    

提交回复
热议问题