Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is usually a mistake to invoke the run() method on a Thread object. When invoked directly, the statements in the run() method execute, however, in the current thread instead of the Thread object itselfnewly created thread. Furthermore, if the Thread object was is not constructed from a Runnable object , nor from but by instantiating a subclass of Thread that overrides does not override the run() method, then the a call to the subclass's run() method invokes Thread.run() which itself does nothingnot perform any useful operations.

It is recommended that if you have a Thread object that extends Runnable, and you wish to execute the object's run() method in the current thread, first cast the object to a Runnable and then invoke run().

...