Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Java Programming/Keywords/volatile

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

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: <member-variable>; or <member-variable>; For example: private volatile changingVar; See also: Java Programming/Keywords/synchronized deep