Home >Java >JavaBase >Java determines whether a thread is running

Java determines whether a thread is running

尚
Original
2019-12-30 14:15:164270browse

Java determines whether a thread is running

Thread.isAlive() can be used in java to determine whether the thread is running, Thread.IsAlive property indicates whether the thread is currently available, if the thread has been started , and if there is currently no exception, it is true, otherwise it is false. (Recommended: java video tutorial)

/**
* Tests if this thread is alive. A thread is alive if it has
* been started and has not yet died.
* @return <code>true</code> if this thread is alive;
* <code>false</code> otherwise.
*/
Thread.isAlive()

For more java knowledge, please pay attention to the java basic tutorial column.

The above is the detailed content of Java determines whether a thread is running. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn