| Author |
overiding start
|
sun par
Ranch Hand
Joined: Oct 03, 2002
Posts: 257
|
|
suppose we overide start() method in a Thread and we have also a run() method, How do we start the thread? Thanks
|
Sunita<br />SCJP 1.4
|
 |
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
|
|
|
You are not supposed to override the start method as it is natively implemented. If you do override, you'll have no way of starting the thread unless you call super.start() within the overriding start method.
|
SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
|
 |
sun par
Ranch Hand
Joined: Oct 03, 2002
Posts: 257
|
|
|
Thanks Valentin
|
 |
Marlene Miller
Ranch Hand
Joined: Mar 05, 2003
Posts: 1391
|
|
|
If you are not supposed to override start, why isn't it declared final?
|
 |
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
|
|
That's a very good question Marlene I think people at Sun did not want to prevent people from overriding start(). Although, they should update the doc and say that it is a very bad practice to do so, and that if overriding is not an option not to forget to invoke super.start() somewhere in the body of the overriding method. Kathy could maybe shed some light on this...
|
 |
 |
|
|
subject: overiding start
|
|
|