title: How to use static global variables in JAVA
body: <p>I am developing a Java Program, I have 2 different classes that need to share variables with each other. So for this purpose I created a third class, which contains these shared variables. Basically, first class has its own flag in this third class, and second class has its own flag in this third class. And I add "extend ThirdClass" to other classes' definition, of course.</p>
  
  <p>My problem is when I change the value of first class' flag in the first class' main method, second class is not able to see this change. Namely, it sees the flag with inital value.</p>
  
  <p>I think this is about static variables. But I do not know the solution. </p>
  
  <p>Actually, I have two servers and multi clients. I am trying to simulate differenet situations of these servers for my distributed systems course. Each server has its own data table that is synchronized with other. By simulation, I mean server may be down or up, and when client try to reach down server I need to direct it to other server. So, between clients and servers I need to send information.</p>
  
  <p>How can I share variables between two classes, and easily modify these variables by any class without loss of previous modifications ?</p>
  
  <p>Thank you.</p>