Regards, Abdul Mohsin
cmbhatt
Regards, Abdul Mohsin
synchronized(Letters.class)
Regards, Abdul Mohsin
John said,
that you can directly manipulate static member, whilst another thread owns lock on that class's "Class object".
cmbhatt
Regards, Abdul Mohsin
Abdul said,
...but how come acquiring lock on .class will synchronized System.out present in non static method.
cmbhatt
Originally posted by Abdul Mohsin:
Hi
But in my case we are acquiring lock on .class and not on System.out, I agree that if we put lock on System.out then it will give correct results but how come acquiring lock on .class will synchronized System.out present in non static method.
Regards,
Abdul Mohsin
Regards, Abdul Mohsin
cmbhatt
Regards, Abdul Mohsin
cmbhatt
Originally posted by Chandra Bhatt:
Nice John,
Did you consider the output from my code where I marked output as Line #1 and Line #2. I would like to get the reason for that sequence from you.
cmbhatt
eat bricks! HA! And here's another one! And a tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|