cmbhatt
apigee, a better way to API!
cmbhatt
apigee, a better way to API!
Also, you have not called super.run() so the code in the parent class (java.lang.Thread)will never be called. agree?
cmbhatt
cmbhatt
When you construct a Thread object using the constructor that takes
Runnable, because Runnable overrides the run() method, it's run method is
called.
apigee, a better way to API!
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.
cmbhatt
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.
common![]()
-cmbhatt![]()
apigee, a better way to API!
there is no constructor such this in MyThread class
cmbhatt
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.
apigee, a better way to API!
new MyThread().start();
cmbhatt
new MyThread(new MyRunnable());
cmbhatt
apigee, a better way to API!
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|