How does the JVM terminate daemon threads? or How to write daemon threads that terminate gracefully
I just wrote the following code as a test: public class DaemonThreadPlay { public static void main(String [] args) { Thread daemonThread = new Thread() { public void run() { while (true) { try { System.out.println(“Try block executed”); Thread.sleep(1000l); } catch (Throwable t) { t.printStackTrace(); } } } @Override public void finalize() { System.out.println(“Finalize method … Read more