firstthread.java
来自「国外的数据结构与算法分析用书」· Java 代码 · 共 16 行
JAVA
16 行
/** A simple class which demonstrates extending Thread. The class simply increments
an instance variable until a flag is turned off. The value of the
instance variable is then displayed to the console. */
public class FirstThread extends Thread
{
int count = 0;
static volatile boolean running = true; // shared by all instances of the class
public void run()
{
while (running)
count++;
System.out.println("count is: " + count);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?