Can the `volatile` keyword be applied to both primitive and reference types in Java?
No, `volatile` can only be applied to primitive types like `int` or `boolean`, but not reference types like objects.
Thatâ€™s incorrect. `volatile` can be applied to both primitive types and object references, but the behavior for objects is a bit different.
Can you explain what happens when a `volatile` reference to an object is accessed by multiple threads?