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;
}
|
No comments:
Post a Comment