Java.util.TimerTask Class

Java.util.TimerTask Class


The java.util.TimerTask class represents a task that can be scheduled for one-time or repeated execution by a Timer.

Class declaration

Following is the declaration for java.util.TimerTask class:

public abstract class TimerTask
   extends Object
   implements Runnable

Class constructors

S.N.Constructor & Description
1protected TimerTask()

This constructor creates a new timer task.

Class methods

S.N.Method & Description
1boolean cancel()

This method cancels this timer task.

2abstract void run()

This method represents the action to be performed by this timer task.

3long scheduledExecutionTime()

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

Methods inherited

This class inherits methods from the following classes:

  • java.util.Object

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.