// From A Beginning Programmer's Guide to Java
// at http://beginwithjava.blogspot.com/

// Used in the article 'Repetition in Java: The Timer Class'
// at http://beginwithjava.blogspot.com/2010/07/repetition-in-java-timer-class.html
// Mark Graybill, July 2010

import java.util.*;

public class TimerTest {
    public static void main(String[] arg){
        Timer tickTock = new Timer();  // Create a Timer object
        TimerTask tickTockTask = new TimerTask(){
           // This is what we want the Timer to do once a second.
            public void run(){
             System.out.println("Tick");
             System.out.println("Tock");
            }
        };

        tickTock.schedule(tickTockTask, 1000, 1000);
    }
}
