Possible Duplicate:
What is the difference between a synchronized method and synchronized block in Java?
What is the difference between a synchronized function and synchronized block?
i dont understand the difference between these 2 codes for threading i believe it is for mutual exclusion but i dont understqnd whats the difference can you help me?
public synchronized void Method1 () {
}
public myFunction (){
synchronized (this) {
}
}
Thanks for the help.