title: Java object is gc-ed when it's still linked with a strong reference and a weaked reference
body: <p>Here I have an example:</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.lang.ref.WeakReference;
  
  public class WeakRefTest {
      public static void main(String[] args) {
          Object obj = new Object();
          WeakReference&lt;Object&gt; weakRef = new WeakReference&lt;Object&gt;(obj);
          int i = 0;
          while (true) {
              if (weakRef.get() != null) {
                  i++;
                  System.out.println("The object is alive for " + i + " loops - " + weakRef);
              } else {
                  System.out.println("The object has been collected.");
                  break;
              }
          }
      }
  }
  </code></pre>
  
  <p>When running this program, we'll get output with <code>"The object has been collected."</code> after a while, which means the object will be gc-ed. </p>
  
  <p>However, there is still a strong reference named <code>"obj"</code> linked to the object, how can it be reclaimed? Because JVM found there is no strong reference usage later, so it's not strong reachable?</p>