I am learning java multi-threading, I found it’s hard to understand how synchronized block works:
synchronized(Object o){
// do something
}
please give some example code that can show me the Object o is blocked. As how I understand this, accessing object o from another thread will be blocked while the synchronized block is being excuted?
Read more: http://javarevisited.blogspot.com/2011/04/synchronization-in-java-synchronized.html#ixzz2LOWwnCjH
Please Look at this Example