A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
doubt in sleep() method
manas ranjan mandal
Joined: Apr 02, 2008
Aug 21, 2008 09:44:00
why sleep() method in Thread class is static?why is the reason behind to made is a static method?
thanks in advance
Joined: Oct 13, 2005
Aug 21, 2008 09:52:00
Presumably so you can access it without knowing the name of the thread you are running on.
Joined: Oct 14, 2005
Aug 21, 2008 12:08:00
If it were an instance method then you could cause other threads to sleep, by calling their sleep() method. That would be a bad thing.
Don't get me started about those stupid
subject: doubt in sleep() method
if method is on Stack and object is on heap then where do Static method is stored
How to use sleep ?.
override sleep method
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014