What does a volatile variable in Java do?

vlolatile is a special modifier that can only modify member variables. In the absence of synchronization classes in Java concurrent programs, multi-thread operations on member variables are transparent to other threads. volatilel variables guarantee that the next read operation will occur after the previous write operation

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325347444&siteId=291194637