In how many ways we can the thread? in java

Answer Posted / virendrasinh gohil

The only way to create a thread is using a thread class.
(Either by extending it or creating object elsewhere).
Runnable does very little contribution here. It's just
that, the thread object expects instance of a class which
should have run() (semantics) method and is called via
runnable interface. Runnable method doesn't create any
thread by itself (sounds dumb as everybody knows Runnable
is an interface).

Calling Thread's start() is the only way in java to spawn a
separate independed execution with in the application.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is replacefirst in java?

562


What are the restriction imposed on a static method or a static block of code?

589


What is used of static keyword in java?

581


Convert Binary tree to linked list.

580


How does linkedhashmap work in java?

511






Explain which of the following methods releases the lock when yield(), join(),sleep(),wait(),notify(), notifyall() methods are executed?

606


What are the main uses of the super keyword?

547


Is java 1.7 the same as java 7?

528


What is variable and constant explain with example?

525


Why we use protected in java?

530


Is call by reference possible in java?

527


What is a jit compiler?

627


Explain the importance of finally over return statement?

602


What is your platform?s default character encoding and how to know this?

1747


How to make object serializable in java?

540