Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   best way for implementing thread in java (http://www.go4expert.com/forums/implementing-thread-java-t27574/)

khushboo652 11Jan2012 11:46

best way for implementing thread in java
 
pls give me the answer which is the best way to implement thread in java runnable interface or inheritance and why?

shabbir 11Jan2012 16:29

Re: best way for implementing thread in java
 
What all ways you have tried and looking for best amont them?

virxen 11Jan2012 20:07

Re: best way for implementing thread in java
 
http://www.go4expert.com/showthread.php?t=4202

dagdu 8Feb2012 16:47

Re: best way for implementing thread in java
 
By implementing runnable interface is best way to implement.By implementing we can reuse that thread and we can extends any other useful class.

alia123 13Jan2016 16:58

Re: best way for implementing thread in java
 
Hello,
There are two ways of implementing threading in Java

1) By extending java.lang.Thread class, or

2) By implementing java.lang.Runnable interface.

Read more:
http://javarevisited.blogspot.in/201...d-in-java.html
Check this site for examples.

RRT2010 8Feb2016 05:45

Re: best way for implementing thread in java
 
Also you can see if you require to Synchronize the threads. This may be needed if you have many threads running in parallel to avoid concurrency.


All times are GMT +5.5. The time now is 03:07.