title: why does it always give the same time?
body: <p>I used the following program to get the clock.What it turned out to be is a <em>static clock</em> ? Why is it so ?</p>
  
  <pre><code>import java.util.*;
  import java.awt.*;
  import javax.swing.*;
  
  class tester {
  
      JFrame fr = new JFrame();
      JPanel p = new JPanel();
      JLabel l = new JLabel();
      Date d = new Date();
      GregorianCalendar gc = new GregorianCalendar();
  
      tester() {
          p.setBackground(Color.red);
          l.setVisible(true);
          p.add(l);
          fr.add(p);
          fr.setSize(200,200);
          fr.setVisible(true);
          startClockThread();
      }
  
      public void startClockThread() {
          Runnable r = new Runnable() {
              @Override
              public void run() {
                  startClock();
              }
          };
          new Thread(r).start();
      }
  
      public void startClock() {
          l.setVisible(true);  
          while(true) {
              l.setText(gc.get(gc.HOUR) + ":" + gc.get(gc.MINUTE) + ":" + gc.get(gc.SECOND));
              System.out.println(gc.get(gc.SECOND));
          }
      }
  
      public static void main(String args[]) {
          new tester();
      } 
  } 
  </code></pre>