title: How do I have the console display only ONE output at a time?
body: <p>So I'm making a clock program on Java, and in the console, it displays all the outputs, as it repeated goes in loops. Here's my program:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class clock
  {
      public static void main(String[] args)
  
      throws InterruptedException
      {
          Scanner Input = new Scanner(System.in);
  
          System.out.print("HOUR: ");
  
          int hrs = Input.nextInt();
  
          System.out.print("MIN: ");
  
          int min = Input.nextInt();
  
          System.out.print("SEC: ");
  
          int sec = Input.nextInt();
  
          while (true)
          {
          System.out.println(hrs + ":" + min + ":" + sec);
  
          sec = sec + 1;
  
          if (sec &gt; 59)
          {
              sec = 0;
  
              min = min + 1;
          }
          if (min &gt; 59)
          {
              min = 0;
  
              hrs = hrs + 1;
          }
          if (hrs &gt; 12)
          {
              hrs = 1;
          }
          Thread.sleep (1000);
          }
      }
  }
  </code></pre>
  
  <p>In the console, I get:
      9:43:35
  9:43:36
  9:43:37
  9:43:38
  9:43:39
  9:43:40</p>
  
  <p>How can I have it such that it shows only the current time, and not the time displayed before?</p>