Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread.sleep() Method  RSS feed

 
Thomas Markl
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does this compile (Thread.sleep())???


And this (sleep() )doesn’t compile:
[ edited to correct formatting -ds ]
[ September 07, 2002: Message edited by: Dirk Schreckmann ]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because sleep() is a static method of the Thread class. TestMyThread7 does not extend the Thread class nor does it have its own sleep() method so it fails to compile.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!