File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes delay Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "delay" Watch "delay" New topic
Author

delay

Lucy Sommerman
Ranch Hand

Joined: Nov 25, 2004
Posts: 61
What's the best way to add 10 second delay withing main () if not using threading?

thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Thread.currentThread().sleep(10000);

will do that even in a single-threaded application.


Ping & DNS - updated with new look and Ping home screen widget
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
Thread.sleep(10000) will do. sleep() method is static in Thread class and it causes the current thread to sleep for the specified number of milli-seconds.


keep smilin :: sravan<br /><a href="http://sravanpens.blogspot.com" target="_blank" rel="nofollow">I scribble here</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: delay
 
Similar Threads
Advice sought on Automation approach...
JFileChooser Performance
Log files: Websphere
Note
Web services book for beginners