Java Utility Library

Java.util.TimerTask Class



Java TimerTask Class

Java.util package has a TimerTask class which represents a task that can be scheduled for one-time or repeated execution by a Timer.

Class declaration

The declaration of java.util.TimerTask class is:

public abstract class TimerTask
  extends Object
    implements Runnable

Class Constructor

S.NConstructors & Description
1. protected TimerTask()
Creates a new timer task.

java.util.TimerTask Methods

The java.util.TimerTask class has a number of methods which are listed below:

Member Methods

S.NMethods & Description
1. boolean cancel()
Cancels this timer task.
2. abstract void run()
The action to be performed by this timer task.
3. long scheduledExecutionTime()
Returns the scheduled execution time of the most recent actual execution of this task.

Methods inherited

This class inherits the methods of following class:

  • java.lang.Object