package com.freeflying.thread.base;
/**
* @ClassName: IsAlive
* @Description:测试线程是否处于活动状态
* @author freeflying
* @date 2018年6月22日
*/
public class IsAlive {
public static void main(String[] args) {
IsAliveEx isAliveEx=new IsAliveEx();
//determines whether the current thread is active
System.out.println("begin == " + isAliveEx.isAlive());
isAliveEx.start();
//determines whether the current thread is active
System.out.println("end == "+isAliveEx.isAlive());
}
}
class IsAliveEx extends Thread{
@Override
public void run() {
//determines whether the current thread is active
System.out.println("run="+this.isAlive());
}
}
测试线程活动状态
最新推荐文章于 2024-05-25 22:01:07 发布