Originally posted by Chandra Bhatt: quote: Ummm... So it can be overloaded.
What would we miss if we overloaded start(); Wont calling start() on thread lose its meaning. It should have been final as I think...
Whoops... I see you quoted my mistaken "overloaded" in the few seconds before I corrected it to "overridden" (and it looks like you didn't notice either ). Sorry, I haven't had enough caffeine today.
Anyway, what if we want start() to do something in addition to starting the thread? That is, do some stuff, and then call super.start()? [ March 31, 2007: Message edited by: marc weber ]
Joined: Feb 28, 2007
I see you quoted my "overloaded" in the minute or two before I corrected it to, "overridden" (and it looks like you didn't notice either ).
Hey marc! That's perfect guess, I didn't notice; I felt it was "overridden". But we got our answer out of you, "perform some prior operations if required and call super.start()" Great!
Thanks and Regards, cmbhatt
Joined: Feb 03, 2007
Thanks for Your replies, especially Marc.
Joined: Feb 03, 2007
I agree with your explanation. But can't such a thing be done inside the run method( i mean whatever initializations need be performed )?Is there any particular loss in case by not having start as final?
Originally posted by vishal shekhar: But can't such a thing be done inside the run method( i mean whatever initializations need be performed )?Is there any particular loss in case by not having start as final?
That goes to the difference between extending Thread and implementing Runnable (which is talked about in detail here). In most cases it's sufficient to implement Runnable (in which case you obviously wouldn't need start to be overridable), but sometimes (rarely) you actually want to alter the behavior of the Thread class, in which case it may be vital to be able to override it. [ June 29, 2007: Message edited by: Ulf Dittmer ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com