This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes doubt in sleep() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "doubt in sleep() method " Watch "doubt in sleep() method " New topic

doubt in sleep() method

manas ranjan mandal
Ranch Hand

Joined: Apr 02, 2008
Posts: 97
why sleep() method in Thread class is static?why is the reason behind to made is a static method?
thanks in advance
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
Presumably so you can access it without knowing the name of the thread you are running on.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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:
subject: doubt in sleep() method
It's not a secret anymore!