Merge pull request #729 from Sanarous/patch-1

修改Java并发守护线程部分
This commit is contained in:
CyC2018
2019-06-20 23:19:20 +08:00
committed by GitHub

View File

@ -223,12 +223,13 @@ public static void main(String[] args) {
main() 属于非守护线程。
使用 setDaemon() 方法将一个线程设置为守护线程。
在线程启动之前使用 setDaemon() 方法可以将一个线程设置为守护线程。
```java
public static void main(String[] args) {
Thread thread = new Thread(new MyRunnable());
thread.setDaemon(true);
thread.start();
}
```