Exforsys
+ Reply to Thread
Results 1 to 3 of 3

keyword

This is a discussion on keyword within the Java forums, part of the Programming Talk category; what is use of volatile keyword??...

  1. #1
    sampra is offline Junior Member Array
    Join Date
    Mar 2008
    Location
    bangalore
    Answers
    9

    Red face keyword

    what is use of volatile keyword??


  2. #2
    Guptha_S is offline Member Array
    Join Date
    Jan 2006
    Answers
    47
    When we try to access a field, VM Optimizes field access by temporary result in local variable

    Volatile is useful when we want to access a field with multiple threads without synchronizing.

    When we use Volatile keyword, Above mentioned VM's optimization feature is disabled and the temporary results will not be stored in local variable.


  3. #3
    sampra is offline Junior Member Array
    Join Date
    Mar 2008
    Location
    bangalore
    Answers
    9
    can u gv a small example
    Quote Originally Posted by Guptha_S View Post
    When we try to access a field, VM Optimizes field access by temporary result in local variable

    Volatile is useful when we want to access a field with multiple threads without synchronizing.

    When we use Volatile keyword, Above mentioned VM's optimization feature is disabled and the temporary results will not be stored in local variable.



    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...