wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Thread.sleep() Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Thread.sleep() Method" Watch "Thread.sleep() Method" New topic
Author

Thread.sleep() Method

Thomas Markl
Ranch Hand

Joined: Mar 08, 2001
Posts: 192
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

Joined: May 05, 2000
Posts: 13974
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.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Thread.sleep() Method
 
Similar Threads
synchronized method
syncronizing run() method
Daemon Thread
join() method; guarenteed behaviour
Thread class join() method