aspose file tools*
The moose likes Threads and Synchronization and the fly likes Question on Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Question on Thread" Watch "Question on Thread" New topic
Author

Question on Thread

Suresh Rajadurai
Ranch Hand

Joined: Feb 22, 2007
Posts: 58
Hi Gurus,

Can anybody explain me why the following code is giving run-time error?



Output is:
foo
Exception in thread "main" java.lang.IllegalThreadStateException


many thanks

Suresh.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

Suresh Rajadurai wrote:



Output is:
foo
Exception in thread "main" java.lang.IllegalThreadStateException


You are starting a Thread t which is already started, which cause an IllegalThreadStateException.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question on Thread