package ThreadDemo; /** * @author:Gerry * @description: * @date: Created in 2018/12/25 */ public class Daemon { public static void main(String[] args) { Thread thread = new Thread(new DaemonRunner(), "DaemonRunner"); thread.setDaemon(true); thread.start(); } static class DaemonRunner implements Runnable { @Override public void run() { try { SleepUtils.second(10); } finally { System.out.println("DaemonThread finally run."); } } } }