// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Timer;
import java.util.TimerTask;

public class TimerTest {
    public static void main(String[] args) throws InterruptedException {
        Timer timer = new Timer();
        timer.schedule(new TestTask(), 1000, 2000);
        Thread.sleep(10000);
        timer.cancel();
    }
}

class TestTask extends TimerTask {
    public void run() {
        System.out.println("Hejsa!!");
    }
}
