📄 threadlife.java
字号:
class ThreadTest implements Runnable
{
private boolean bFlag=true;
public void stopMe()
{
bFlag=false;
}
public void run()
{
while(bFlag){
System.out.println(Thread.currentThread().getName() +"run");
}
}
}
public class ThreadLife
{
public static void main(String []args)
{
ThreadTest t=new ThreadTest();
new Thread(t).start();
for(int i=0;i<100;i++)
{
if(i==50)
t.stopMe();
System.out.println("main run");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -