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

Can we override data members in java?

632


What are adapter classes?

602


What is the common usage of serialization? What exceptions occur during serialization?

606


What is null mean in java?

627


What is the default value of an object reference declared as an instance variable?

542






What is the difference between final, finally and finalize()?

548


What are java packages? What is the significance of packages?

574


What is java ceil?

573


What is the original name of java?

544


What is classname class in java?

536


What is the difference between instanceof and isinstance?

568


How infinite loop is declared?

541


Why constructor has no return type?

638


What are methods of a class?

544


What is the abstraction?

594