Originally Posted by
padhu1989
I cant understand the execution steps of this program..
You must know that when threads are involved, there is very little that is "guaranteed".
For example:
thread1.start();
thread2.start();
thread3.start();
There's absolutely
no guarantee that the run() of thread1 really starts before the run() of thread2 (and run() of thread2 before that of thread3).
And even if "casually" the order would be this, the thread scheduler is completely free to suspend the thread at any given moment and give the CPU to another thread.
Thus, basing on this explanation, are you still sure that the print of:
[Hello (by Caller ob1)
[Synchronized (by Caller ob2)
[World (by Caller ob3)
will always happen in this exact order?