I was learning daemon thread content from "Think in Java", however, while I tried to run to daemon thread and was expecting some output, it gave me nothing... my programming IDE is Eclipse and operating system is ubuntu13.04... Please let me know what is going on. The following code will output msg if you comment out "t.setDaemon(true);"
public class Practice implements Runnable{
@Override
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(1000);
System.out.println(Thread.currentThread()+" "+this);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Daemon is working");
}
public static void main(String[] args){
Thread t = new Thread(new Practice());
t.setDaemon(true);
t.start();
}
}