Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java Language
Expertise: Beginner
Dec 4, 1998



Application Security Testing: An Integral Part of DevOps

Delaying a Program

Can you please tell me how to delay the program flow in Java? I can't find any implementation of delay().

To introduce a delay into your program, use the Thread.sleep method. It takes an integer argument specifying the number of milliseconds to delay the current thread of execution. If you call this method from your main application thread, it will delay your program for the specified period of time. Remember, Thread.sleep is a static method and does not require a reference to a Thread instance.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date