Here is the code example, the output of two methods named method1() and method2() is different. The code difference in second method is thread T2 is started after join() method which is invoked on thread T1 but in first method, both threads T1 and T2 are started first and then join() method is invoked.
In method1(), there is a possibility of both T1 and T2 running at the same time. In method2(), the main thread waits for T1 to complete by join()'ing itself to the end of T1. When T1 completes, the main thread resumes and starts T2.