title: Java - Count in COUNTDOWNLATCH
body: <p>While running each thread why does the countdown.getCount() always print '3' even after the previous thread has already called countdown.countDown() and reduced the Latch Count by 1?</p>
  
  <p>I am kind of worndering how Java knows that the Latch Count has reached 0, so that it can release all the 3 threads.</p>
  
  <pre><code>import java.util.concurrent.CountDownLatch;
  
  class b {
  static final CountDownLatch countdown = new CountDownLatch(3);
  
  public static void main(String[] args) {
  
      for (int i = 0; i &lt; 3; ++i) {
          Thread t = new Thread() {
              public void run() {
                  System.out.printf("Starting on %d other threads.\n",
                          countdown.getCount());
                  countdown.countDown();
                  System.out.printf("new on %d other threads.\n",
                          countdown.getCount());
                  try {
                      countdown.await(); // waits until everyone reaches this
                                          // point
                      // System.out.println("Go again : "
                      // +countdown.getCount());
                  } catch (Exception e) {
                  }
              }
          };
          t.start();
  
      }
      System.out.println("Go");
  }
  </code></pre>
  
  <p>}</p>