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

📄 interruptcheck.java

📁 Java Thread Programming (Source
💻 JAVA
字号:
public class InterruptCheck extends Object {
	public static void main(String[] args) {
		Thread t = Thread.currentThread();
		System.out.println("Point A: t.isInterrupted()=" + t.isInterrupted());
		t.interrupt();
		System.out.println("Point B: t.isInterrupted()=" + t.isInterrupted());
		System.out.println("Point C: t.isInterrupted()=" + t.isInterrupted());

		try {
			Thread.sleep(2000);
			System.out.println("was NOT interrupted");
		} catch ( InterruptedException x ) {
			System.out.println("was interrupted");
		}

		System.out.println("Point D: t.isInterrupted()=" + t.isInterrupted());
	}
}

⌨️ 快捷键说明

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