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

What is singleton math?

0 Answers  


what are the major differences between jdk1.4 and jdk1.5?

2 Answers   Cap Gemini, Crimson Logic, Infosys, TCS, Tenth Planet,


How is string immutable in java?

0 Answers  


What is a super method?

0 Answers  


Define a java class.

1 Answers  






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

0 Answers  


When should a function throw an exception?

0 Answers   Thomson Reuters, Virtusa,


State the difference between creating string as new () and literal.

0 Answers  


what's diff between struts 1.1 & 1.2

3 Answers   Wipro,


Explain a situation where finally block will not be executed?

0 Answers  


What is quick sort in java?

0 Answers  


What is the root class for all Java classes?

8 Answers   IBM, Infosys,


Categories