Wednesday, 20 August 2014

You have thread T1, T2 and T3, how will you ensure that thread T2 run after T1 and thread T3 run after T2?

This thread interview questions is mostly asked in first round or phone screening round of interview and purpose of this multi-threading question is to check whether candidate is familiar with concept of "join" method or not. Answer of this multi-threading questions is simple it can be achieved by using join method of Thread class.

main(){

t1.start();
t1.join();
t2.start();
t2.join();
t3.start();

}

No comments:

Post a Comment