title: Change String in Thread
body: <p>This looks like the simplest runnable I could imagine</p>
  
  <pre><code>public class StringShower implements Runnable{
  
      private volatile boolean running = true;
      private String text;
  
      public StringShower(String text){
          this.text = text;
      }
  
      @Override
      public void run() {
          while (running) {
              try {
                  System.out.println("Current text" + text);
                  if(text != null){
                      showText(text); 
                  }
                  Thread.sleep((long) 1000);
              } catch (Exception e) {
                  running = false;
              }
          }       
      }
  
      private void showText(String text2) {
          System.out.println("Current Text " + text2);
  
      }
      public void stopRunning() {
          this.running = false;
      }
  </code></pre>
  
  <p>That is the class starting it</p>
  
  <pre><code>public class ChangeString {
  
    private static String changeme;
  
      public static void main(String[] args) {
        Thread thread1 = new Thread(new StringShower(changeme));
        thread1.start();
  
        changeme = "changed";
    }
  }
  </code></pre>
  
  <p>After reading many examples, I can't still figure out why the <code>String</code> inside the thread is never updated. Can anyone explain why?</p>