aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difference beteween interrupted() and isInterrupted()" Watch "Difference beteween interrupted() and isInterrupted()" New topic

Difference beteween interrupted() and isInterrupted()

ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208

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

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.

I agree. Here's the link:
subject: Difference beteween interrupted() and isInterrupted()
Similar Threads
Difference beteween HashSet and LinkedHashSet.
Interrupted questions! thx!
Difference beteween notify and notifyAll.
Difference beteween two dates