0

How Thread.join() method work??

If t1 and t2 are threads are in runnable state if t1.join is called which will undergo waiting state how it actually works??

1st Nov 2022, 7:55 PM
Shreepriya HA
7 ответов
+ 2
1st Nov 2022, 7:58 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 2
java.lang.Thread.join() method makes one thread to wait until another thread completes its execution.
1st Nov 2022, 7:58 PM
Just Some Random Guy
Just Some Random Guy - avatar
+ 2
Snehil Pandey Ok thank you
1st Nov 2022, 8:42 PM
Shreepriya HA
+ 1
1st Nov 2022, 8:38 PM
Just Some Random Guy
Just Some Random Guy - avatar
0
Snehil Pandey yeah but which thread will wait in multiple threads??
1st Nov 2022, 8:04 PM
Shreepriya HA
0
Shreepriya HA the main one in which the join is called
1st Nov 2022, 8:05 PM
Just Some Random Guy
Just Some Random Guy - avatar
0
Snehil Pandey sorry I couldn't get it...Is that mean main thread is t1 here in my example??
1st Nov 2022, 8:10 PM
Shreepriya HA