📄 startstop.java
字号:
package zjkdata;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class startstop extends Object implements Runnable { private volatile boolean stoprequested; private Thread runthread; public void run() { runthread = Thread.currentThread(); stoprequested = false; int i=0; //System.out.println("线程启动!"); while(!stoprequested) { //System.out.println("运行次数:"+i); i++; try { Thread.sleep(2000); } catch(InterruptedException x) { //System.out.println("线程停止!"); Thread.currentThread().interrupt(); //System.out.println("线程停止了!"); } } } public void stop() { stoprequested = true; if(runthread != null){ runthread.interrupt(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -