title: static fields in Java
body: <p>I have learned that fields are like global variables which can be accessed by the methods inside the same class. I have done it this way before and never had a problem. I have now a class where I have some fields but the methods cannot access them without having to make them static fields. I get the error "cannot make static reference to non-static..."
  I thought static was to access fields on other classes without having to create an object reference to the class. The only difference I have with this code is that I have a single class and my main() method within this class. Does having main() inside this class make a difference?</p>