-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Is that true Thread.sleep(10000) will make current thread to sleep for
10 seconds?
Approximately true. The thread will sleep for 10 seconds then become
scheduled. It will probably run shortly thereafter. The only exception
is that if another thread uses theThread.interrupt(), the sleep() call
will return early and throw InterruptedException.
This is in the JavaDocs. See this location:
http://java.sun.com/j2se/1.5.0/docs/api/
I cannot use Thread.currentThread().sleep(10000) since sleep is a
static method of Thread. Right? Thread.currentThread() will return a
reference to the currently executing thread object.
You can actually enter the line of code you indicated, but it's highly
discouraged, because it means exactly the same as:
Thread.sleep(10000);
It is true that Thread.currentThread() returns a Thread object referring
to the currently executing thread.
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
iD8DBQFC7bnR6ZGQ8LKA8nwRAoDNAKCVXZVyYyRsZe4aZ/BDUjAb5dDBegCfaf4e
v7AimQzQ8h1yOSqIyOnG/4o=
=F+6x
-----END PGP SIGNATURE-----