Can we start a thread twiceNo. After starting a thread, it can never be started again. If you does so, an IllegalThreadStateException is thrown. In such case, thread will run once but for second time, it will throw exception. Let's understand it by the example given below: Test it NowOutput: running Exception in thread "main" java.lang.IllegalThreadStateException Next TopicWhat If We call run() method directly |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India