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.
I agree. Here's the link:
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: doubt in sleep() method
if method is on Stack and object is on heap then where do Static method is stored
override sleep method
How to use sleep ?.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013