-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathThreadInterrupt.java
More file actions
42 lines (37 loc) · 991 Bytes
/
ThreadInterrupt.java
File metadata and controls
42 lines (37 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* <html>
* <body>
* <P> Copyright 1994 JsonInternational</p>
* <p> All rights reserved. - https://github.com/Jasonandy/Java-Core-Advanced </p>
* <p> Created by Jason</p>
* </body>
* </html>
*/
package cn.ucaner.core.thread;
/**
* @Package:cn.ucaner.core.thread
* @ClassName:ThreadInterrupt
* @Description: <p> ThreadInterrupt</p>
* @Author: - bysocket
* @CreatTime:2018年4月5日 下午1:06:55
* @Modify By:
* @ModifyTime: 2018年4月5日
* @Modify marker:
* @version V1.0
*/
public class ThreadInterrupt {
public static void main(String[] args) throws InterruptedException {
Thread inThread = new Thread(new InterrupThread());
inThread.start();
Thread.sleep(1000);
inThread.interrupt();
}
}
class InterrupThread implements Runnable {
private int num = 1;
@Override
public void run() {
while (true)
System.out.println("true ----> " + num++);
}
}