Join() is non static method of Thread class per my understanding what it does is, it let one thread join at to the end of another Thread. Lets see there are three Thread t1, t2,and t3. I want to say lets start t1 then t3 then t2. Is this right please explain the what I need to do bases on the senerio and my code below
Thread t1 = new Thread(); Thread t2 = new Thread(); Thread t3 = new Thread();
When you call start on some thread, it will go to runnable state, then based on thread scheduler it may go to running state.
Your code is saying:
Start 3 threads, order in which they start executing run is not guaranteed and then wait until thread 1 is finished, thread 3 is finished, and thread 2 is finished, then proceed (with some code below).
If you want to be sure, that thread t1 enters run method as first, then you need to synchronize this action and wait (in your main thread) with starting other threads.