java - Difference between synchronized -


is this , example.this same object?

e.g. call this , example.class inside synchronized same object?

class example {     public example() {         synchronized(this) {             // code         }     } }   class example {     public example() {         synchronized(example.class) {             // code         }     } } 

no, this use current object monitor, example.class use example.class monitor.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -