As in the following code, when ther are 2 run methods (that is one implemented from runnable and the other overriden from thread class), how will the start method decide which run to invoke??! please explain me the logic how start method works in this scenario...
Okay, think of it this way...
The new thread calls the run() method of the Thread class... period. It does not "decide" which run() method to run. In fact, it does not even know there is another runnable method, being held as an instance variable, in the Thread class.
It calls the run() method of the Thread class... every time... so... in your example, it will print X.
Now... It is the default run() method, in the Thread class that routes the request to the runnable. And since you overridden it, it will be *not* be executed, and hence, Y will *not* be run.
Henry