Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Thread interrupt method.

 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am preparing for SCJP exam and came across this question in Devaka exam.Could somebody please explain why the user thread is not interrupted even though main thread set the interrupt when the user thread is sleeping?

I see the output as Ex-B followed by exception.Why not Ex-A is not printed?Why the interrupt method not woking here?

 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I got the answer myself.We are setting the interrupt only on 'a' not on 't'.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic