Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Thread

 
Suresh Rajadurai
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic