TimerTask class methods in Java

java.util.TimerTask

A task that can be scheduled for one-time or repeated execution by a Timer.

A timer task is not reusable. Once a task has been scheduled for execution on a Timer or canceled, subsequent attempts to schedule it for execution will throw IllegalStateException.

Some methods of TimerTask class


cancel()This method cancels this timer task.


run()The action to be performed by this timer task.


scheduledExecutionTime()This method returns the scheduled execution time of the most recent actual execution of this task.


No comments:

Post a Comment