Deepak Lal wrote:Hi Ranchers,
I have the below Thread related Queries.
Help Provided will be highly appreciated.
1> I'm new to Threading in java,Can anyone share few Multi threading examples which can help me to understand the concepts of threads in Java Better.?Practical Examples needed for better understanding.Please advice.?
2> Which is better to use ? Runnable Interface (or) Extending the thread class.
3> Can we Override a Run() method in Thread ?
--
Deepak Lal
(unless you don't mind if they are written in Portuguese).
Hmmm a very impolite answer for the Question1 Marcelo Schneider.
Henry Wong wrote:
How is this an impolite answer? He is simply stating that he codes in Portuguese. Did you expect him to port his code to English just as an example for you?
Deepak Lal wrote:2> Which is better to use ? Runnable Interface (or) Extending the thread class.
Campbell Ritchie wrote:There is in fact a good reason for implementing the Runnable interface rather than extending Thread: you can implement several interfaces but only extend one class.
SCJP 6, SCBCD 5, OCEWSD 6
My blog: http://darkleden.wordpress.com
Alexey Saenko wrote:
Here is just one more reason for implementing Runnable interface: you cannot start the same instance of Thread class more than once, but you can start new threads with the same instance of a class which implements Runnable interface.
Alexey Saenko wrote:but you can start new threads with the same instance of a class which implements Runnable interface.
SCJP 6, SCBCD 5, OCEWSD 6
My blog: http://darkleden.wordpress.com
Here is just one more reason for implementing Runnable interface: you cannot start the same instance of Thread class more than once, but you can start new threads with the same instance of a class which implements Runnable interface.
SCJP 6, SCBCD 5, OCEWSD 6
My blog: http://darkleden.wordpress.com
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|