Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Java sleep command


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 gamechampionx   Members   -  Reputation: 132

Like
0Likes
Like

Posted 25 December 2004 - 04:29 AM

Does anyone know the Java command for sleep(), as in to delay program execution?

Sponsor:

#2 Kommi10   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 December 2004 - 04:40 AM

Thread.sleep( (# in miliseconds) );

#3 gamechampionx   Members   -  Reputation: 132

Like
0Likes
Like

Posted 25 December 2004 - 08:09 AM

But how does that work if you're not using Threads, just using one main program type deal? Or is that a static?

#4 BlackLiquid   Members   -  Reputation: 128

Like
0Likes
Like

Posted 25 December 2004 - 09:25 AM

Yes, it's a static method so that's all you need.

#5 Zahlman   Moderators   -  Reputation: 1666

Like
0Likes
Like

Posted 25 December 2004 - 08:08 PM

There is always at least one thread (actually, there basically are always at least two that I can think of...) By writing Thread.sleep() you are asking the Thread class for its static method 'sleep', which will figure out which thread is running and make it sleep.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS