[Kalpesh]: Does it mean that these two instances of class Question52 do not interfere with each others synchronized code AT ALL ?? and if that is true, then this is like only 1 thread accessing 1 instance so synch. doesn't matter. No, the two threads can and do interfere with each other. What Keith was saying is that it's as if there were no synchronization at all - nothing prevents the two threads from executing aMethod() and/or bMethod() simultaneously. And since these methods are accessing the same static variable i, this can create all sorts of problems, depending on what order the two threads do things in.
Suguna, try running the program multiple times.
You should see different output - maybe not different
every time, but at least different
some of the time.
[ November 27, 2006: Message edited by: Jim Yingst ]