Thursday, February 17, 2011

Synchronized methods vs Synchronized block

Synchronized method :

JVM (built into JVM)

  • automatically acquires object's lock 
  • calls the method
  • releases the lock
If an exception occurs thread automatically releases the lock