title: Pass variable value between two classes in java
body: <p>I want to access variables <code>sTerminalId</code> &amp; <code>sTransactionId</code> in Class <code>ServerThread</code></p>
  
  <pre><code>public class ServerThread extends Thread {
  
      /* Some Code Omitted Here */
  
      public void run() {
              String sDataFromPOS="";
              //Get Some Value in sDataFromPOS
              byte[] bSendToPOS = SAXHandler.ParseXMLToString(sDataFromPOS.toString().substring(2));
      }
  }
  
  public class SAXHandler extends DefaultHandler {
  
      static String sTerminalId = "";
      static String sTransactionId = "";
  
      public static byte[] ParseXMLToString(String sXMLData) throws Throwable {
          /* Do Some Operation on String sXMLData &amp; extarct value of sTerminalId &amp; sTransactionId*/
      }
  }
  </code></pre>
  
  <p>What i tried is </p>
  
  <pre><code>SAXHandler.sTerminalId
  </code></pre>
  
  <p><strong>Will get me value but only for one run if run it again it gives me previous value</strong>.
  is there any alternative ? i am dealing with sensitive data so dont want to mess my code</p>