Source Code : Daemon Thread
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Daemon Thread

public class DaemonThread implements Runnable {
public void run() {
System.out.println("entering run()");
try {
System.out.println("in run(): currentThread() is"
+ Thread.currentThread());
while (true) {
try {
Thread.sleep(500);
} catch (InterruptedException x) {
}
System.out.println("in run(): woke up again");
}
} finally {
System.out.println("leaving run()");
}
}
public static void main(String[] args) {
System.out.println("entering main()");
Thread t = new Thread(new DaemonThread());
t.setDaemon(true);
t.start();
try {
Thread.sleep(3000);
} catch (InterruptedException x) {
}
System.out.println("leaving main()");
}
}
Thank with us