In howmany ways a thread can be created?

Answers were Sorted based on User's Feedback



In howmany ways a thread can be created?..

Answer / harish

There are two different ways to create a Thread. One is
extends Thread class and implement Runnable Interface.
Better to go for Runnable interface. It will have a method
run(). You should override in the sub class. Even, you
can extend another class to the same thread class.

Is This Answer Correct ?    3 Yes 0 No

In howmany ways a thread can be created?..

Answer / rajshekhar

There are 2 ways to create a thread
1.By extending thread class
2.and the second one is by implementing runnable
interface.among the two the second one is more common and
better to use.

Is This Answer Correct ?    3 Yes 1 No

In howmany ways a thread can be created?..

Answer / ranganathkini

1. Extending the Thread class
2. Implementing Runnable interface in a class and then
passing its reference to a new Thread.
3. Creating an anonymous class to extend the Thread class.
4. Creating an anonymous class to implement the Runnable
interface and then passing its reference to a new Thread.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Advanced Java Interview Questions

which is the better collection class if the requirement is only displaying the data

1 Answers  


What is the difference between a menuitem and a checkboxmenuitem?

0 Answers  


What are the different types of exception?

0 Answers  


What are callback interfaces?

0 Answers  


What are local interfaces? Describe.

0 Answers  






What is in-memory replication?

0 Answers  


Why threads will block on I/O?

2 Answers  


Are enterprise beans allowed to use thread.sleep()?

0 Answers  


explain session tracking. why we used it

3 Answers   Lionbridge,


What is the O/P of the below Code Snippet ? And how does it imply the concept of call-by-value/call-by-reference. (Note : Pls ignore syntx errors) public class One { sop ("Into One--"); } public class Two extends One{ sop ("Into Two--"); } public class Home { One a; Two t; public static void main(argv[]) { sop ("In Home--"); sop(One.a); sop(Two.a); sop(One.t); sop(Two.t); } }

2 Answers   Wipro,


How will you pass parameters in RMI? Why do you serialize?

0 Answers  


What are the high-level thread states?

1 Answers  


Categories