• Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt in sleep() method

 
manas ranjan mandal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why sleep() method in Thread class is static?why is the reason behind to made is a static method?
thanks in advance
 
Campbell Ritchie
Marshal
Posts: 52580
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presumably so you can access it without knowing the name of the thread you are running on.
 
Paul Clapham
Sheriff
Posts: 21886
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!