Originally posted by Sanny kumar:
Hi,
Can you please answer the questions?
1.What is the type of the �target� data member of the Thread class?
2.How is �target� used to support running direct subclass of the Thread class versus running class implementing Runnable interface?
Thanks
Santhosh
The "target" instance variable of the Thread class is an internal private variable. It is not officially documented, and hence, subject to change in future implementations.
In the current implementation, it is used to store the Runnable object that is passed to the Thread object (assuming the constructor that takes the Runnable is used). The default run() method, if the method has not been overridden, will check the target variable for a Runnable object. And if one exist, it will call the run() method of the runnable object.
Henry