Threads can be created in the following ways :
-Instantiating a class extending java.lang.Thread class and calling start() method
-Creating a java.lang.Thread and passing a reference of a class implementing Runnable interface.Then calling start() method on this object.
-Instantiating a class extending java.lang.Thread class and calling start() method
-Creating a java.lang.Thread and passing a reference of a class implementing Runnable interface.Then calling start() method on this object.
As mentioned,Java supports these two mechanisms for Thread creations but second option is preferred as in first case there is a possibility of single inheritance making a thread object less flexible in its behaviour while in second case a thread object can be clubbed with multiple features.


7 comments:
Hi, my name is Tim. Just wanted to say hi to the forum, I been creeping around here for a while now, but tend to participate more. Looking forward to make some new friends. Ciao!
Tim
NY, NY
Howdy i am new on here. I hit upon this board I find It very useful and its helped me a great deal. I hope to contribute & help other people like it has helped me.
Thanks, See Ya Around
Hi-ya i'm new to this. I stumbled upon this message board I have found It exceedingly helpful & it's helped me out a great deal. I hope to contribute & aid others like it has helped me.
Thank You, Catch You About.
Sup i'm new here. I hit upon this website I have found It truly helpful and it has helped me a lot. I should be able to contribute & aid other people like its helped me.
Cheers all, See You About.
Hello.
The interesting name of a site - www.interviewjava.com, interesting this here is very good.
I spent 4 hours searching in the network, until find your forum!
mithun here
Extend threading
Runnable Threading
..r d 2 types og threading
Post a Comment