scheduledExecutionTime()%uA0方法用于返回此任务最近实际执行的安排执行的时间。
声明
以下是java.util.TimerTask.scheduledExecutionTime()方法的声明。
public long scheduledExecutionTime()
参数
-
NA
返回值
方法调用返回在其中最近执行这项任务被调度发生的时间。
异常
-
NA
例子
下面的例子显示java.util.TimerTask.scheduledExecutionTime()方法的使用
package com.yiibai import java.util.* public class TimerTaskDemo { public static void main(String[] args) { // creating timer task, timer TimerTask task = new TimerTaskCancel() Timer timer = new Timer() // scheduling the task timer.scheduleAtFixedRate(task, new Date(), 1000) // checking scheduled execution time System.out.println("Time is :"+task.scheduledExecutionTime()) } // this method performs the task public void run() { System.out.println("Working on the task assigned") } }
现在编译和运行上面的代码示例,将产生以下结果。
Time is :1335444782599 Working Working Working Working Working Working and so on