title: How to pass a parameter to a thread and get a return value?
body: <pre><code>public class CalculationThread implements Runnable {
  
      int input;
      int output;
  
      public CalculationThread(int input)
      {
          this.input = input;
      }
  
      public void run() {
          output = input + 1;
      }
  
      public int getResult() {
          return output;
      }
  }
  </code></pre>
  
  <p>Somewhere else:</p>
  
  <pre><code>Thread thread = new Thread(new CalculationThread(1));
  thread.start();
  int result = thread.getResult();
  </code></pre>
  
  <p>Of course, <code>thread.getResult()</code> doesn't work (it tries to invoke this method from the <code>Thread</code> class).</p>
  
  <p>You get what I want. How can I achieve this in Java?</p>