scheduledExecutionTime(): This method is available in java.util.TimerTask class of Java.
Syntax:
long java.util.TimerTask.scheduledExecutionTime()
This method returns the scheduled execution time of the most recent actual execution of this task.
Parameters: NA
Returns: the time at which the most recent execution of this task was scheduled to occur.
Exceptions: NA
Approach
Java
import java.util.Date;import java.util.Timer;import java.util.TimerTask;public class TimerTaskscheduledExecutionTime {public static void main(String[] args) {TimerTask task = new TimerTask() {@Overridepublic void run() {}};Timer timer = new Timer();timer.scheduleAtFixedRate(task, new Date(), 1000);System.out.println(task.scheduledExecutionTime());}}
Output:
1649648938391
No comments:
Post a Comment