Answered Questions

  • Determining the order of threads

    Q.--" I created five(5) thread instances,say "1","2","3","4","5" and start all of them at the same time,one after the other. The priorities for the threads are same.what should be done so that the threads run concurrently in the same order,i.e1,2,3,4,5(Is there any way at all)"?

    Vijay

    • Jan 10th, 2014

    We can do that by using the join. In the second thread run method, we can call the join on first thread object. In the third thread run method, we can call the join on second thread object. Like this ...

    mduhan

    • Apr 8th, 2013

    We have to implement run method to create a thread.We need to make that method synchronized so that only one thread can go inside and control will be given to second only and only of first is completed.