每隔10秒钟打印一个“Helloworld”
生活随笔
收集整理的這篇文章主要介紹了
每隔10秒钟打印一个“Helloworld”
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
/*** 每隔10秒鐘打印一個“Helloworld”*/
public class Test03 {public static void main(String[] args) throws InterruptedException {ThreadImp threadImp = new ThreadImp();Thread thread1 = new Thread(threadImp);thread1.start();}
}class ThreadImp extends Thread {public void run() {for (int i = 0; i < 10; i++) {System.out.println("StartThread-"+ (i + 1)+ ":"+ new SimpleDateFormat("yyyy/MM/dd hh:mm:ss:Ms").format(new Date()));System.out.println("hello world");try {sleep(10000);} catch (InterruptedException e) {e.printStackTrace();}}}
}
?
轉(zhuǎn)載于:https://www.cnblogs.com/areyouready/p/7827692.html
總結(jié)
以上是生活随笔為你收集整理的每隔10秒钟打印一个“Helloworld”的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 交通银行青年卡黑卡和白卡的区别:卡面一黑
- 下一篇: 2018民生小白卡申请条件 申请资料备好