Thread is unusual in that it can reference Runnable to run, but it is also Runnable . By default, Thread will use itself as an instance of Runnable to run, although of course you can specify it somewhere else.
I think there is no good reason to mark Thread final and require an external Runnable or make Thread extensible and have its own Runnable . Both approaches are perfectly fine, and none of them seem to be a much better choice than the other.
If I were to guess, the reason for creating Thread subclassable is that it allows you to write code as follows:
Thread t = new Thread() { public void run() { } };
This is a little cleaner than subclassing Runnable and then wrapping it in a stream. Similarly, you can subclass Thread to get Runnable , which clearly indicates that it should be used as a thread. Of course, this is mostly a matter of aesthetics, and if Java designers had gone a different way, I think it would be a great solution.
templatetypedef
source share