Java Programming/Keywords/volatile

volatile is a keyword.

When member variables are marked with this keyword, it changes the runtime behavior in a way that is noticeable when multiple threads access these variables. Without the volatile keyword, one thread could observe another thread update member variables in an order that is not consistent with what is specified in sourcecode. Unlike the synchronized keyword, concurrent access to a volatile field is allowed.

Syntax:

private volatile <member-variable>;
or 
volatile private <member-variable>;


For example:

Computer code
private volatile changingVar;


See also: