What is the key difference between the volatile keyword and the synchronized keyword in Java?
volatile can be used for blocking threads, while synchronized cannot
volatile ensures visibility of variables across threads, while synchronized ensures mutual exclusion
volatile guarantees atomicity, while synchronized does not
volatile prevents deadlocks, while synchronized does not
This question is part of this quiz :
Java Deadlocks and Synchronization