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

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -