Intermediate
Kotlin
Q87 / 100
What is the purpose of Kotlin's @Volatile annotation?
Correct! Well done.
Incorrect.
The correct answer is B) Maps to Java's volatile keyword, ensuring visibility of changes across threads without caching in CPU registers
B
Correct Answer
Maps to Java's volatile keyword, ensuring visibility of changes across threads without caching in CPU registers
Explanation
@Volatile var flag = false ensures reads/writes go directly to main memory, making state changes visible across threads immediately.
Progress
87/100