...
| Code Block | ||
|---|---|---|
| ||
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 | ||
|---|---|---|
| ||
Thread thread = new Thread(new Runnable() {
@Override public void run() {
// ...
}
});
((Runnable) thread).run(); // Exception: This does not start a new thread
|
...