Versions Compared

Key

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

...

Code Block
bgColor#FFCCCC
public final class Foo implements Runnable {
  @Override public void run() {
    // ...
  }

  public static void main(String[] args) {
    Foo foo = new Foo();
    new Thread(foo).run();
  }
}

...

Code Block
bgColor#ccccff
Thread thread = new Thread(new Runnable() {
   @Override public void run() {
      // ...
    }
  });

((Runnable) thread).run();  // Exception: This does not start a new thread

...