Here are my two classes:
public class Firstclass {
public static void main(String args[]) throws InterruptedException {
System.out.println(\"Main sta
There are two types of threads user and daemon. So if you want your program to exit make your thread a daemon.
Example
Thread t = new Thread();
t.setDaemon(true);
The process terminates when there are no more user threads.
To your second Question:
Join is to be used only when you need to ensure that the thread dies & you have nothing to do after that
Synchronization is for inter-thread-communication