Java.util.TimerTask Class


Advertisements

Introduction

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

Sr.No. Constructor & Description
1

protected TimerTask()

This constructor creates a new timer task.

Class methods

Sr.No. Method & Description
1 boolean cancel()

This method cancels this timer task.

2 abstract void run()

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

3 long 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
Advertisements