REMINDER.JAVA import java.util.Timer; import java.util.TimerTask; /** * Simple demo that uses java.util.Timer to schedule a task to execute * once x seconds have passed. */ public class Reminder { Timer timer; public Reminder(int seconds) { timer = new Timer();//creates new time timer.schedule(new RemindTask(), seconds*1000);//delay is in milliseconds } class RemindTask extends TimerTask { public void run() { System.out.format("Time's up!%n"); timer.cancel(); //Terminate the timer thread } } } DRIVER.JAVA public class Driver { public static void main(String args[]) { System.out.format("About to schedule task.%n");//output System.out.format("Task scheduled.%n");//output new Reminder (3); //call Reminder.java for timer with 3 seconds } }