A

Admin • 828.43K Points
Coach

Q. Which of the following is true about the `volatile` keyword in Java?

  • (A) It makes a variable read-only
  • (B) It guarantees visibility of changes to variables across threads
  • (C) It synchronizes a block of code
  • (D) It locks the object for other threads

Explanation by: Admin
`volatile` ensures that updates to a variable are visible to all threads.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.