title: Java Thread, change value in thread from main
body: <p>With the thread class defined below, if the main calls the thread by:</p>
  
  <pre><code>     Thread foo = new aThread1();
       foo.start();
  </code></pre>
  
  <p>Is it possible to change the value of xxx from the calling class?  It was simple to change variables while in the thread OF the main class, but I can't seem to go the other way.</p>
  
  <pre><code>class aThread1 extends Thread {
  volatile static int xxx = 1;
  public void run() {
          try {
              sleep(10000);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          System.out.println("Current value: " + xxx);
      }
   }
  </code></pre>