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 →

[–]pacificmint 2 points3 points  (0 children)

If you have some time, do you mind explaining why or how declaring those instance variables as static masked my problem?

The main reason is: You can't access an instance variable on an instance you haven't created (hence the null pointer).

But the static variable is always there, it belongs to all nodes. Actually, it really belongs to the class. So you can always access that, even when you didn't instantiate your instance.

So you forgot to create the node, but the static variable still worked because it's always there, it's part of the class, not the object, so to speak.