Also, you have not called super.run() so the code in the parent class (java.lang.Thread)will never be called. agree?
When you construct a Thread object using the constructor that takes
Runnable, because Runnable overrides the run() method, it's run method is
This is the reason why, i suggested to see the implementation of java.lang.Thread.run(). I thought it will give you a clarity of the same. That method is the only place where the delegation to the passed runnable instance is done. If this method does not execute, the runnable run method will not be executed.
Originally posted by Chandra Bhatt:
The whole story came to my mind when I went through your following lines
And specially If this method does not execute, the runnable run method will not be executed.
there is no constructor such this in MyThread class
It is not compiler error.
I dont require MyThread() constructor
(default constructor), so I didn't define it.
I needed a constructor that require Runnable so I defined that.
[QB]I overlooked the following line you added to my latest code:
new MyThread(new MyRunnable());