your code doesn't compiles on my machine,may be problem with my JDK1.6,which i have installed a fresh copy
try this code given below.
mohitkumar gupta wrote:
so,Thread t1 or t2 whosoever runs first would automatically acquire lock on XSync object when,it see's synchronize(this).then,that thread would not release lock until the code in synchronized block or function is complete
Am,i right now ?
yes,XXX2X2 can be possible,try it.
see that you have two different thread references which are invoking two different methods,no use of synchronization here.