DaemonThread

// This class extends Thread
class MyThread extends Thread {
    MyThread() {
        // Thread can be set as a daemon thread in the constructor
        setDaemon(true);
    }

    // This method is called when the thread runs
    public void run() {
        // Determine if this thread is a daemon thread
        boolean isDaemon = isDaemon();
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.