I am a little confused about which objects do we synchronize when we synchronize a code block. When we synchronize a method, is the method synchronized or the object?
well it depends on you...if you are designing as system that only one thread can access then sychronized it....imagine if you have a application which deals banking...threads can freelyy withdraw and deposits... try this link...http://java.sun.com/docs/books/tutorial/essential/threads/index.html