MyThread.java Source code

Java tutorial

Introduction

Here is the source code for MyThread.java

Source

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

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

public class Main {

    public static void main(String[] args) throws Exception {

        Thread thread = new MyThread();
        System.out.println("thread = " + thread.currentThread());
        thread.setDaemon(false);

        thread.start();
    }
}