Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

What is the purpose of a Volatile Variable?

Sumit Rawal answered on May 21, 2023 Popularity 5/10 Helpfulness 1/10

Contents


More Related Answers

  • volatile asembly
  • Why volatile keyword is used for?
  • benefits of volatile keyword

  • What is the purpose of a Volatile Variable?

    0

    Volatile variable values can be modified by different threads. They will never have the chance to block and hold a lock. Synchronization will happen whenever the variables are accessed. Using volatile may be faster than a lock, but it will not work in some situations. The range of situations in which volatile is effective was expanded in Java 5; in particular, double-checked locking now works correctly.

    Popularity 5/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: java volatile
    Link to this answer
    Share Copy Link
    Contributed on May 21 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.