Answer
The volatile keyword tells the compiler that a variable may be modified by multiple threads.
It prevents certain optimizations and ensures every read returns the most recent value.
The volatile keyword tells the compiler that a variable may be modified by multiple threads.
It prevents certain optimizations and ensures every read returns the most recent value.
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.
Sign in to access all features and personalize your learning experience.
Source: SugharaIQ