Java Multithreading concept and join() method

You must understand , threads scheduling is controlled by thread scheduler.So, you cannot guarantee the order of execution of threads under normal circumstances. However, you can use join() to wait for a thread to complete its work. For example, in your case ob1.t.join(); This statement will not return until thread t has finished running. Try … Read more