Monday, April 30, 2007

What are two ways of creating threads in Java and why so?

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.
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.


Anonymous said...

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!



Anonymous said...

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

Anonymous said...

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.

Anonymous said...

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.

Anonymous said...

The interesting name of a site -, interesting this here is very good.
I spent 4 hours searching in the network, until find your forum!

Anonymous said...

mithun here

Anonymous said...

Extend threading
Runnable Threading
..r d 2 types og threading


Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker