Please have a look at the code:
public class A extends
Thread {
A() {
setDaemon(true);
}
public void run() {
(new B()).start();
try {
Thread.sleep(60000);
} catch (InterruptedException x) {}
System.out.println("A done");
}
class B extends Thread {
public void run() {
try {
Thread.sleep(60000);
} catch (InterruptedException x) {}
System.out.println("B done");
}
}
public static void main(
String[] args) {
(new A()).start();
}
}
*************
No o/p is printed
But if in the sleep calls 60000 is replaced by 10
We get:
A done
B done.
Can u explain it?