⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deprecatedstop.java

📁 Java Thread Programming (Source
💻 JAVA
字号:
public class DeprecatedStop extends Object implements Runnable {

	public void run() {
		int count = 0;

		while ( true ) {
			System.out.println("Running ... count=" + count);
			count++;

			try {
				Thread.sleep(300);
			} catch ( InterruptedException x ) {
				// ignore
			}
		}
	}


	public static void main(String[] args) {
		DeprecatedStop ds = new DeprecatedStop();
		Thread t = new Thread(ds);
		t.start();

		try {
			Thread.sleep(2000);
		} catch ( InterruptedException x ) {
			// ignore
		}

		// Abruptly stop the other thread in its tracks!
		t.stop();
	}
}

⌨️ 快捷键说明

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