Timer in Java is a utility class that is used to schedule tasks for both
one time and repeated execution. Timer is similar
to the alarm facility many people use in mobile phones. Just like you can have one
time alarm or repeated alarm, You can use java.util.Timer to
schedule a time task or repeated task. In fact, we can implement a Reminder utility
using Timer in Java and that's what we are going to see in this example of Timer in Java. Two classes java.util.Timer and java.util.TimerTask is used to
schedule jobs in Java and forms Timer API. The TimerTask is an actual task that is executed by Timer. Similar to Thread in Java, TimerTask also implements the Runnable interface and overrides run method to specify a task details.
This post first appeared on Javarevisited: Blog About Java Programmin, please read the originial post: here