Multiple choice

What is the role of volatile keyword in java?

  1. Volatile keyword is used to achieve synchronization in java.

  2. Volatile keyword determines that the volatile variable reads the value form the main memory only.

  3. Volatile variable is used in a multithreading environment.

  4. All of the above

  5. Only (2) and (3)

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Yes, all of the above three are the true statements about the volatile variable in java.