Javatpoint Logo
Javatpoint Logo

Java Thread isInterrupted() method

The isInterrupted() method of thread class is an instance method that tests whether the thread has been interrupted. It returns the value of the internal flag either true or false. If the thread is interrupted then it will return true otherwise false.

Syntax

Return

It will return true if the thread has been interrupted otherwise returns false.

Example

Test it Now

Output:

is thread interrupted..: false
is thread interrupted..: false
is thread interrupted..: true
is thread interrupted..: false
doing task....: 1
doing task....: 2
doing task....: 3
doing task....: 1
doing task....: 2
doing task....: 3

Next TopicJava Thread





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA