Explain different ways of creating a thread?



Explain different ways of creating a thread?..

Answer / Gautam Sinha

"There are several ways to create threads in Java:n
1. Extending Thread class: By creating a subclass of the Thread class and overriding its run() method.
2. Implementing Runnable interface: By implementing the Runnable interface and providing an implementation for its run() method.
3. Using ExecutorService: By using the ExecutorService interface to manage multiple threads, which can be useful for larger applications."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the difference between the file and randomaccessfile classes?

1 Answers  


What is the difference between java and .Net?

39 Answers   Bosch,


we have two threads..both the threads are reading the data.. is there any need of synchronization there?...justify it?

4 Answers   IBM,


What is tochararray in java?

1 Answers  


What is boolean data type in java?

1 Answers  


Which is dependent variable?

1 Answers  


Is jdk required on each machine to run a java program?

1 Answers  


What is use of a abstract variable?

1 Answers  


What is a parameter in a function?

1 Answers  


What are the interfaces defined by Java.lang package?

1 Answers  


what is comparable and comparator interface?

1 Answers  


Can you explain the private protected field modifier?

1 Answers  


Categories