How many ways can a thread be used?

Answer Posted / muruganantham

Two ways we can using in Thread. One is Thread class and
another one is Runnable interface. If we are using extends
Thread class means you must override the run() method. We
can create a thread object after that we used start method.
Its only one waiting (wait())thread can be executed
Ex:
Thread t=new Thread();
t.start();

If we are using implement Runnable Interface means you need
not override the run() method. We can passing the parameter
is thread . Its more than one waiting (wait())thread can be
executed.


Hi
This is Muruga. Sorry for gramatical mistake bze that my
level. If any feed back pl reply to my mail id
sunjavamuruga@gmail.com

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are the elements of a borderlayout organized?

593


What is the form of storage space in java?

1738


What are the call back methods in entity bean?

558


AS a developer will u create a data source in connection pool? If so how will u do that, how to access the object from connection pool using IRAD tool?

1633


What is the argument type of a programs main() method?

562






To what value is a variable of the string type automatically initialized?

607


Where can I find seam examples and documentation?

566


What is the diffrence between a local-tx-datasource and a xa-datasource?

577


What if the static modifier is removed from the signature of the main method?

702


How task's priority is used in scheduling?

1781


Explain the different types of memory used by jvm?

613


What is in-memory replication?

558


Why use POJO when I can use hashmap

2045


What are the diff types of exception?

557


What happens when a thread cannot acquire a lock on an object?

537