title: static variable lose its value
body: <p>I have helper class with this static variable that is used for passing data between two classes.</p>
  
  <pre><code>public class Helper{
      public static  String paramDriveMod;//this is the static variable in first calss
  }
  </code></pre>
  
  <p>this variable is used in following  second class mathod</p>
  
  <pre><code>    public void USB_HandleMessage(char []USB_RXBuffer){
      int type=USB_RXBuffer[2];
      MESSAGES ms=MESSAGES.values()[type];
      switch(ms){
          case READ_PARAMETER_VALUE:  // read parameter values
              switch(prm){
                  case PARAMETER_DRIVE_MODE:  // paramet drive mode
                      Helper.paramDriveMod =(Integer.toString(((USB_RXBuffer[4]&lt;&lt; 8)&amp;0xff00)));
                      System.out.println(Helper.paramDriveMod+"drive mode is selectd ");
                      //here it shows the value that I need...........
              }
      }
      //let say end switch and method
  }
  </code></pre>
  
  <p>and the following is an third class method use the above class method</p>
  
  <pre><code>public void buttonSwitch(int value) throws InterruptedException{
      boolean bool=true;
      int c=0;
      int delay=(int) Math.random();
      while(bool){
          int param=3;
          PARAMETERS prm=PARAMETERS.values()[param];
          switch(value){
              case 0: 
                  value=1;
                  while(c&lt;5){
                      Thread.sleep(delay);                
                      protocol.onSending(3,prm.PARAMETER_DRIVE_MODE.ordinal(),dataToRead,dataToRead.length);//read drive mode
                      System.out.println(Helper.paramDriveMod+"  drive mode is ..........in wile loop");//here it shows null value
                  }
                  //break; ?
          }
      }
      //let say end switch and method
  }
  </code></pre>
  
  <p>what is the reason that this variable lose its value?</p>