Synchronized Methods in Java

user919860 picture user919860 · Sep 1, 2011 · Viewed 11.4k times · Source

Just wanted to check to make sure that I understand this. A synchronized method doesn't create a thread, right? It only makes sure that no other thread is invoking this method while one thread within the same process (ie the JVM) is using it, right?

Answer

mre picture mre · Sep 1, 2011

A synchronized method doesn't create a thread, right?

Right.

It only makes sure that no other thread is invoking this method while one thread within the same process (ie the JVM) is using it, right?

Right.

For more information, read Synchronized Methods. I also recommend reading Java Concurrency in Practice.