title: Runnable class object
body: <p>I don't have much experience with threading in Java. How can I get the value of String ft all way from inside Runnable(){} to use it in main(). </p>
  
  <pre><code>public class testInner {
      public static void main (String[] args){
          Outer out =new Outer();
          out.makeinner();
          System.out.println("main :" + out.getft());
      }
  }
  public class Outer {
      private volatile String ft;
      public String getft(){
          return ft;
      }
      public void makeinner(){
          inner in = new inner();
          in.changeOuter();
      }
      public class inner{
          public void changeOuter(){
              new Thread(new Runnable(){
                  public void run(){
                      ft = "what?";
                      System.out.println("run :" + ft);
                  }
              }).start();
          }
      }
  }
  </code></pre>
  
  <p>Result when compiled:</p>
  
  <pre><code>main :null
  run :what?
  </code></pre>