标签:timer 用途 lock [] hello time system ring 延迟
用途:做定时器用的。
public static void main(String[] args) {
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
System.out.println("hello!");
}
},new Date(System.currentTimeMillis()+5000),1000); //延迟5s执行,没1s执行一次
}
标签:timer 用途 lock [] hello time system ring 延迟
原文地址:https://www.cnblogs.com/xujie09/p/10322361.html