Share on Google+Share on Google+

volatile Java Keyword

Advertisement
The volatile is a keyword defined in the java programming language.

volatile Java Keyword

     

The volatile is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java programming language likewise the volatile keyword indicates the following :

-- The volatile keyword is mostly used to indicate that a member variable of a class may get modified asynchronously by more than one thread.
-- This thing is noticable that the volatile keyword is not implemented in many Java Virtual Machines.
-- The volatile keyword from the side of compiler tries to guarantee that all the threads should see the same value of a specified variable.

Example to use the volatile keyword in a class:

public class Cla

{

volatile int sharableValue;

}

 

Advertisements

Posted on: June 12, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: volatile Java Keyword  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
vikas
July 1, 2011
volitile

you should be give more explanation on volatile key word.