A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: doubt in sleep() method
How to use sleep ?.
override sleep method
if method is on Stack and object is on heap then where do Static method is stored
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014