how to create thread in java?

Answers were Sorted based on User's Feedback



how to create thread in java?..

Answer / mohan

by extending thread class or by implementing runnable
interface

Is This Answer Correct ?    15 Yes 0 No

how to create thread in java?..

Answer / guest

There are two methods available
1.by using extends keyword
2.by using interfaces

Is This Answer Correct ?    16 Yes 3 No

how to create thread in java?..

Answer / bijoy

Their are specifically two different approaches to create
threads in Java:
1.By Extending thread class.
2.By Implementing runnable interface.

Is This Answer Correct ?    13 Yes 0 No

how to create thread in java?..

Answer / vamsikrishna

we can do it in two ways.
one is by extending thread class and other is by
implementing Runnable interface.
here the later one is good because when we are going for
mutiple inheritance only interface helps us

Is This Answer Correct ?    8 Yes 0 No

how to create thread in java?..

Answer / rahul madanan

There are two methods to create thread in java :
(1). By extending the Thread class.
(2). By implementing the Runnable interface.

Is This Answer Correct ?    6 Yes 1 No

how to create thread in java?..

Answer / bijoy kumar baral

There is two ways for creating Thread in Java:
1.Extending Thread class

2.Implementing Runnable Interface

Second one is much more benificial than 1st one,as we can
able to avoid the overriden methods.

Is This Answer Correct ?    5 Yes 1 No

how to create thread in java?..

Answer / vijay tandel

Thread can be created by

1. Extending Thread Class
2. implementing Runnable interface

The second approach is better as if you want to use multiple
inheritance, interface is better option.

Is This Answer Correct ?    4 Yes 0 No

how to create thread in java?..

Answer / poorna chandar rao

thread is created in two ways
one is extends Thread class
and another way is implements runnable interface

in thees two ways implements runnable interface is better
option because it supports multilevle thread cocept

Is This Answer Correct ?    2 Yes 0 No

how to create thread in java?..

Answer / gurpreet singh

there are two ways to creat the thread:
1. by implement Runnable interface
2. by extends Thread
NOW which one is batter apprach
implement Runnable Thread is batter apporach
because in inheritance does not allow its
class to extends more than one...
Where we use mutiple inheritance then we creat
a Thread by using implement runnable interface
that why its batter apporach
ok concept is understood.
Gurpreet singh

Is This Answer Correct ?    2 Yes 0 No

how to create thread in java?..

Answer / mask

Thread can be created by tow way
1.interface
2.runnable interface

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More OOPS Interview Questions

can we make a class static without using static keyword?

5 Answers   Aspire,


How can you overcome the diamond problem in inheritance?

0 Answers   NIIT,


What is virtual constructors/destructors?

4 Answers   IBS,


What is the difference between pass by value,pass by pointer,pass by reference in the catch block in the exception handling in c++

1 Answers   TCS,


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

0 Answers  






What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); } 1) 1 2) 0 3) Code cannot compile

4 Answers  


What is oops and why we use oops?

0 Answers  


Why do we use polymorphism in oops?

0 Answers  


wht is major diff b/w c and c++?

10 Answers  


What is friend function?

12 Answers   Wipro,


Can private class be inherited?

0 Answers  


how to create thread in java?

17 Answers   IBM, Infosys, Wipro,


Categories