当前位置:网站首页>Timer create timer
Timer create timer
2022-07-07 05:14:00 【Yang Asang 815】
import java.util.Timer;
import java.util.TimerTask;
public class TestDamo {
public static void main(String[] args) {
Timer timer=new Timer();// The timer itself is a thread
timer.schedule(new TimerTask() {
@Override
public void run() {
System.out.println(Thread.currentThread()+" Do it once ");
}
},3000,2000);
/*
* Timer A single thread , Process multiple tasks and execute them in sequence , There is a difference between the delay and the time of setting the timer
* Maybe because of one of the exceptions Timer Thread death , Thus affecting subsequent tasks ,
* */
}
}
Timer A single thread , Process multiple tasks and execute them in sequence , There is a difference between the delay and the time of setting the timer
* Maybe because of one of the exceptions Timer Thread death , Thus affecting subsequent tasks ,
边栏推荐
- Analysis -- MySQL statement execution process & MySQL architecture
- Is PMP really useful?
- 最长不下降子序列(LIS)(动态规划)
- Complete code of C language neural network and its meaning
- Time complexity & space complexity
- 高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍
- 创始人负债10亿,开课吧即将“下课”?
- 2. Overview of securities investment funds
- [736. LISP syntax parsing]
- 最长回文子串(动态规划)
猜你喜欢
随机推荐
Thread和Runnable创建线程的方式对比
Ansible overview and module explanation (you just passed today, but yesterday came to your face)
装饰器基础学习02
Auto. JS get all app names of mobile phones
App embedded H5 --- iPhone soft keyboard blocks input text
AOSP ~Binder 通信原理 (一) - 概要
想要选择一些部门优先使用 OKR, 应该如何选择试点部门?
U++4 接口 学习笔记
The sooner you understand the four rules of life, the more blessed you will be
基于Bevy游戏引擎和FPGA的双人游戏
一文搞懂常见的网络I/O模型
2. Overview of securities investment funds
腾讯云数据库公有云市场稳居TOP 2!
最长不下降子序列(LIS)(动态规划)
[736. LISP syntax parsing]
Timer创建定时器
STM32 encapsulates the one key configuration function of esp8266: realize the switching between AP mode and sta mode, and the creation of server and client
ASP. Net MVC - resource cannot be found error - asp Net MVC – Resource Cannot be found error
2.证券投资基金的概述
Weebly移动端网站编辑器 手机浏览新时代