From the
java API start()
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. Thus, it will invoke the Threads run method. The Thread A has two potential run methods- the base class which will call start on Runnable B which prints B, and the derived class A which will call the run which prints A.
Which of these two methods will be invoked when the start method is called? It is bound dynamically, and actually is of type A, not Thread, so binds to the A method, and prints A.
Consider these as well:
This will print B.
If you comment out this line:
Then B is printed. It is no longer being dynamically bound- the run method is not overridden.
[ September 24, 2004: Message edited by: Tom Tolman ]