Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the purpose of the 'volatile' keyword in programming?
Answer: 'volatile' is used to indicate that a variable's value may be changed by multiple threads simultaneously, preventing compiler optimizations that assume the variable can only be changed by the current thread.

Example:

Declaring a variable as 'volatile' in Java for thread safety.
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook