how many ways to create Thread and which one is good?
runnable interface ot Thread class?

Answers were Sorted based on User's Feedback



how many ways to create Thread and which one is good? runnable interface ot Thread class?..

Answer / balaji@cse@crr engg@eluru

types of creating thread
1)extend thread class
2)implement by runnable interface
=>2"nd method is good because by using interface we can
implement multiple inheritance

Is This Answer Correct ?    16 Yes 0 No

how many ways to create Thread and which one is good? runnable interface ot Thread class?..

Answer / guest

Two ways to create threads
1)by creating thread class
class classname extends Thread
{


}
2)By converting class to thread ie using Runnable interface

Is This Answer Correct ?    11 Yes 3 No

how many ways to create Thread and which one is good? runnable interface ot Thread class?..

Answer / srinu

Two ways of creating Thread
1)By extending java.lang.Thread class
2)By implementing java.lang.Runnable interface
Here 2"nd way is good because by using interface we can
implement multiple inheritance in our class

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More Core Java Interview Questions

Why do we need singleton class?

0 Answers  


What is java Applet?

0 Answers   TCS,


What is bifunction in java?

0 Answers  


Is there is any error if you have multiple main methods in the same class?

10 Answers   Infosys, Wipro,


can u give one sinario when you use Abstract Class and When you use Interface.

5 Answers   ITC Infotech,






Explain what access modifiers can be used for methods?

0 Answers  


Is map ordered in java?

0 Answers  


can we write a program with out a class in core java?

11 Answers   Wipro,


What is a void return type?

6 Answers  


Can we create object of inner class in java?

0 Answers  


What is the significance of continue jump statement? Explain with an example.

0 Answers   Amdocs,


Define inheritance with reference to java.

0 Answers  


Categories