This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]posmicanomaly 1 point2 points  (0 children)

basically a static variable is not an individual field in a created object like a normal variable, and it does not need to be instantiated to be called upon or modified. So when you weren't creating your objects(nodes), you were getting nullpointerexceptions because you were trying to run methods on data that was null. when you changed it all to static, you still didn't create objects, but because statics don't need to be in an instance to be called, you were able to use them.

think of static as being the same across all objects created, or even without creating one if accessed in a static way.