MyThread.java Source code

Java tutorial

Introduction

Here is the source code for MyThread.java

Source

class MyThread extends Thread {
    MyThread() {
        setDaemon(true);
    }

    public void run() {
        boolean isDaemon = isDaemon();
        System.out.println("isDaemon:" + isDaemon);
    }
}

public class Main {
    public static void main(String[] argv) throws Exception {
        Thread thread = new MyThread();
        thread.setDaemon(true);
        thread.start();
    }
}