Possible Duplicate:
synchronized block vs synchronized method?
Hi all I was wondering is Snippet-A simply a syntax sugar for Snippet-B? :
Snippet A:
public synchronized void F() {
//..code
}
Snippet B:
public void F() {
synchronized (this) {
//..code
}
}
Or rather, what exactly is the difference between the two pieces of code above?