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

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

555


what are getters and setters in Java with examples?

1264


what is a portable component?

1441


For which statements does it make sense to use a label?

566


How to implement dphibernate to activate lazy loading in Flex with java ?thanx in advance!

2533






What is the RMI and Socket?

603


What is ripple effect?

616


Why are my checkboxes not being set from on to off?

616


Why are some of the class and element names counter-intuitive?

545


int x=5,i=1,y=0; while(i<=5) { y=x++ + ++x; i=i+2; } System.out.println(x); System.out.println(y); System.out.println(i); How to solve this? Please explain!

1336


What restrictions are placed on the values of each case of a switch statement?

512


Can we sent objects using Sockets?

624


Which container method is used to cause a container to be laid out and redisplayed?

643


What event results from the clicking of a button?

669


Can you control when passivation occurs?

576