title: Java Thread using static or non-static nested class
body: <p>I've encountered a very strange problem.
    My program looks like this:</p>
  
  <pre><code>class Outter{
  
        class Inner extends Thread {
             public void run(){
                 // do something
             }
        }
  
        public void func() {
             new Inner().start();
             // Thread.sleep() for a while to see if the above thread has finished
             // if not stop the thread
    }
  </code></pre>
  
  <p>The problem is the Inner class seems never run really. So the func will always stop it before it does what it supposed to do. The two threads should run concurrently, but actually only the main thread is running, the other is in running state, but blocked.
     I try to change the Inner class to be a static class. This time it works well.
     But still I don't the reason, hope someone can help to explain it.</p>