Hi all I was running the following code,but the output is intermixed although the test method is synchronized. What i understand is when a method is synch no other thread can access that method b4 it is finish What am i missing here.
Thanks for your help cornel Dave put in UBB code tags [ December 09, 2002: Message edited by: Dave Vick ]
Synchronization, the way you've done it, works on objects, not classes. You've created two objects, so the threads are free to switch between the print outs. If you want them to be synchronized by class, then synchronize a static method ... or, and this is the easier way in your case, don't use two threads.