This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difference beteween interrupted() and isInterrupted() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference beteween interrupted() and isInterrupted()" Watch "Difference beteween interrupted() and isInterrupted()" New topic
Author

Difference beteween interrupted() and isInterrupted()

ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208
HI

Please explain me the basic difference beteween interrupted() and isInterrupted() methord of Thread class.

Thanks
Regards
Gaurav
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
interrupted() is a class method in Thread that determines if the current thread has been interrupted.

isInterrupted() is an instance method that determines if the thread instance that calls it has been interrupted.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
See this thread
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Another big difference is that interrupted() tests and clears the interrupted status flag, but isInterrupted() just tests the interrupted status flag leaving the flag in the state it finds it.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208
Thanks a lot to you all.
Now i am clear about that.

Thanks
Gaurav
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Difference beteween interrupted() and isInterrupted()
 
Similar Threads
Object
Difference beteween HashSet and LinkedHashSet.
Difference beteween two dates
Interrupted questions! thx!
Difference beteween notify and notifyAll.