title: bug thread handling in java
body: <pre><code>public class Test extends Thread{
      public void hello(String s){
          System.out.println(s);
      }
      public void run(){
          hello("I’mrunning...");
      }//endofrun()
      public static void main(String [] args){
          Test t=new Test();
      System.out.println("always first");
          t.start();
  
          System.out.println("always second but why?");
      } 
  } 
  </code></pre>
  
  <p>I've run that chunk of code 30 times. </p>
  
  <p>Why is "always second but why?" always second on the console? When t.start() is called, we have 2 threads. (2 stacks):  the main thread and the second thread. so "i'am running" has to be sometimes the second output on the console. When i delete the "always first" output statement than the two outputs left, behave non deterministic (that's the way it should be) </p>
  
  <p>so what is wrong in my thinking, why is System.out.println("always first"); influencing the concurrency? </p>