Wednesday, August 5, 2015

Difference between Thread.interrupted() and isInterrupted


       Thread.interrupted() is a final static method which is defined in the base thread class  and isInteruptted is a non static method in the thread class. Both returns the interrupt status of the thread.  One is called on the object of the thread to get the status since the interrupted() method is static this is called by Thread.interrupted().
      Thread.interrupted() returns true if the thread has interrupt flag set and resets the interrupt flag. while isInterrupted() method is a check for the flag and doesnt resets the flag
   

No comments:

Post a Comment