Java Thread isAlive() method

The isAlive() method of thread class tests if the thread is alive. A thread is considered alive when the start() method of thread class has been called and the thread is not yet dead. This method returns true if the thread is still running and not finished.

Syntax

Return

This method will return true if the thread is alive otherwise returns false.

Example

Test it Now

Output:

before starting thread isAlive: false
after starting thread isAlive: true
is run() method isAlive true

Next TopicJava Thread




Latest Courses