If you try to start thread again , it will throw IllegalThreadStateException
No, Once you have started a thread, it can not be started again. If you try to start thread again , it will throw IllegalThreadStateException
Lets understand with the help of example:
When you run above program , you will get below output:
Recommended Articles
- thread
Java Timer exampleSept 23, 2018
Timer is an utility class which can be used to schedule tasks on specific time or repeatedly. Lets say, you are developing an banking application a...
- Exchanger
Java Exchanger exampleSept 23, 2018
Exchanger class is introduced with java 1.5 with other classes such ConcurrentHashMap, CountDownLatch, Semaphores. Exchanger class i...
- BlockingQueue
BlockingQueue in javaSept 23, 2018
BlockingQueue in java BlockingQueue is introduced in java with concurrent package with ConcurrentHashMap. It is thread safe queue ...
- Semaphore
Java Semaphore exampleSept 23, 2018
Semaphore is a class in java.util.concurrent package introduced in JDK 5. Semaphore basically maintains a set of permits, so there are two methods wh...
Newer Article
Can we call run() method directly to start a new thread
Older Article
Daemon thread in java with example
Labels:
thread