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.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: The volatile keyword
Post your Comment