Why is this not working? Its java.
public class Program { public static void main(String[] args) { } } public class Clock extends Thread { java.text.DateFormat f = //How to format time for this local java.text.DateFormat.getTimeInstance(java.text.DateFormat.MEDIUM); volatile boolean keepRunning = true; public Clock() { //The constructor setDaemon(true); // Daemon thread: interpreter can exit while it runs start(); // This thread starts itself } public void run() { // body of thread while(keeprunning) { // This thread runs until asked to stop String time = f.format(new java.util.Date()); // Current time System.out.println(time); //Print the time try { Thread.sleep(1000); } catch (InterupptedException e) { } } // Ask the thread to stop running public void pleaseStop() { keepRunning = false; } }