Java – How to delay few seconds
来源:互联网 发布:网络协议分析器 编辑:程序博客网 时间:2024/06/07 02:37
In Java, you can use Thread.sleep(miliseconds)
to make the current executing Java program to sleep or delay few seconds.
TestSleep.java
package com.mkyong.test;import java.util.Date;public class TestSleep { public static void main(String[] args) { System.out.println("Testing..." + new Date()); try { //sleep 5 seconds Thread.sleep(5000); System.out.println("Testing..." + new Date()); } catch (InterruptedException e) { e.printStackTrace(); } }}
Output
Testing...Tue Sep 22 17:26:51 SGT 2015Testing...Tue Sep 22 17:26:56 SGT 2015
0 0
- Java – How to delay few seconds
- java-How to delay few seconds
- Python – How to delay few seconds
- How to delay a method call dynamically?
- mt2523 How to delay some time
- How to get Joomla Website to Load in 1.29 Seconds
- How to add a DELAY in applying transactions in GoldenGate?
- How to Ajax auto refresh after x seconds
- From Java to Groovy in a few easy steps
- Using IP Instances with VLANs or How to Make a Few NICs Look Like Many
- How to Hook Up a VS.NET 2005 Solution With CruiseControl.NET in a Few Minutes
- How to scan whole Internet 3.7 billion IP addresses in few minutes?
- HOW TO: remove the 300ms delay when clicking on a link in JQuery Mobile
- How to Run Cron Every 5 Minutes, Seconds, Hours, Days, Months
- How to fix hung_task_timeout_secs and blocked for more than 120 seconds problem
- 60 seconds to Spring
- seconds to minutes
- Java – How to split a string
- new一个类对象和使用类名创建一个对象有什么区别?
- matplotlib简介
- UITableView下拉刷新
- UIViewContentMode各种模式的样式
- 知识的学习与管理
- Java – How to delay few seconds
- C++中输出有效数值位数问题
- [JQ权威指南]第十七天:show()与hide()方法
- iOS开发上架常用证书,appID,Provisioning Profiles配置说明及制作图文教程
- Intel MCE 之增强的CACHE ERROR REPORTING
- 随机优化工具 Stochastic Optimization Techniques
- Linux中find常见用法示例
- Recover Binary Search Tree
- IOS 后台无限执行任务