Here are my two classes:
public class Firstclass {
public static void main(String args[]) throws InterruptedException {
System.out.println(\"Main sta
Your main
thread is not closed -
// ...
System.out.println("Main close...");
// <--- Your main method is here while all the other threads complete (sort of).
}
On part 2 of your question - There is no connection between join
and synchronized
. They are almost opposite.
join
- Wait for the thread to complete before resuming.synchronized
- Only one thread can enter here, all others must wait.