Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Help Java V The volatile keyword

Related Tutorials


Share on Google+Share on Google+

The volatile keyword

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

The volatile 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. The volatile keyword is mostly used to indicate that a member variable of a class may get modified asynchronously by more than one thread.

Syntex:  Here is the syntax that shows how to use the keyword volatile.

public class Myclass {

volatile int sharableValue;


Note: Here are some points that must be considered while declaring and defining a variable as volatile.

  • 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.

If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  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.

Posted on: November 18, 2009

Related Tutorials

Discuss: The volatile keyword  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image