Skip to main content
1 of 6
cat
  • 5.9k
  • 2
  • 26
  • 44

#Java, 300 bytes

This is the first time I've ever written Java and... wow. Just wow.

import java.util.Date;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar;class Main{public static void main(String[]args){while(true){DateFormat dateFormat=new SimpleDateFormat("HH:MM:ss");Calendar cal=Calendar.getInstance();System.out.println(dateFormat.format(cal.getTime()));try{Thread.sleep(1000);}catch(InterruptedException ex){Thread.currentThread().interrupt();}}}}

Ungolfed:

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
class Main {
    public static void main(String[] args) {
        while (true) {
            DateFormat dateFormat = new SimpleDateFormat("HH:MM:ss");
            Calendar cal = Calendar.getInstance();
            System.out.println(dateFormat.format(cal.getTime()));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                Thread.currentThread().interrupt();
            }
        }
    }
}
cat
  • 5.9k
  • 2
  • 26
  • 44