testfirstrunnable.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 17 行

JAVA
17
字号
/**	A simple class to test class FirstRunnable.  It creates three instances of
	FirstRunnable, and lets them run for half a second, then stops their running
	so they can display their result. */
public class TestFirstRunnable
{
	public static void main(String[] args) throws InterruptedException
	{
		FirstRunnable r1 = new FirstRunnable();
		FirstRunnable r2 = new FirstRunnable();
		FirstRunnable r3 = new FirstRunnable();

		Thread.sleep(500); // can throw an exception
		FirstRunnable.running = false;
		Thread.sleep(2000); // can throw an exception
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?