例子1:如何将一个线程设置成守护线程[code]package li.thread.method;public class ThreadMethodExercise { public static void main(String[] args) throws InterruptedException { MyDaemonThread myDaemonThread = new MyDaemonThread(); //如果我们希望当主线程结束后,子线程自动结束,只需要将子线程设置为守护线程 myDaemonThread.setDaemon(true); myDaemonThread.start(); for (int i = 1; i
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) | Powered by Discuz! X3.4 |