Java print hello world every 3 seconds

www.l‮tua‬turi.com
Java print hello world every 3 seconds
/**
 * @author lautturi.com 
 * Java example: perform scheduled tasks in java
 */
import java.util.Timer;
import java.util.TimerTask;

public class Lautturi {

	public static void main(String[] args) {

		class SayHello extends TimerTask {
			public void run() {
				System.out.println("Hello World!");
			}
		}

		Timer timer = new Timer();
		timer.schedule(new SayHello(), 0, 3000);

	}
}
Created Time:2017-09-23 13:21:55  Author:lautturi