I'm working on an RPG, but I've hit a stumbling block - Static Variables. I searched in the Internet, but I'm not sure I understand completely.
Let's say I have a Quest Class, and from the Main Class, I create two Quest Objects:
Now I have a Control class, and want to print out the quests' names:Code:static Quest q, p;
If I don't make the Quest variables static, I can't access them. When I make them static, am I making the global? i.e. if I change their name from the Main, when I access them from the Control do I find their names changed?Code:public class Control {
public void controlPrint() {
System.out.println("1: " + Main.q.getQuestName());
System.out.println("2: " + Main.p.getQuestName());
}
}
Thanks a lot in advance.
