General rule of thumb about things static. If you have a good explanation why something should be static, then it probably should be static. If you haven’t got a good explanation, then making anything static is a serious design error. “It compiles like that,” is a very bad explanation.
Using ints instead of enumerated types, eg direction, is a bad move. It might be permissible in C, but it is not at all good design in Java.
Alex Munoz wrote:How could I make my code compatible with static context?
Easiest is usually to create a object, and then call methods on that object.
I'll bet dollars to doughnuts that the reason you're getting these error messages about 'static context' is because you're trying to call your class methods directly from main(); and that's NOT how you should do things.
As Campbell said, making things static is usually a BAD idea. In the case of main() you have no choice; but you should generally avoid using it anywhere else unless you have a good reason for doing so.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Joined: Oct 26, 2012
I guess I'm confused as to how I implement this. What needs to change?